
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>2.Element UI 源码初探 · Gary的小窝</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="Gary">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism-solarizedlight.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-theme-comscore/test.css">
                
            
        

    

    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="bind.html" />
    
    
    <link rel="prev" href="proxy.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    写在前面
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../leetcode/">
            
                <a href="../leetcode/">
            
                    
                    Leetcode之旅
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../leetcode/1.html">
            
                <a href="../leetcode/1.html">
            
                    
                    1.两数之和
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../leetcode/2.html">
            
                <a href="../leetcode/2.html">
            
                    
                    2.两数相加
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../leetcode/3.html">
            
                <a href="../leetcode/3.html">
            
                    
                    3.无重复字符的最长子串
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../leetcode/4.html">
            
                <a href="../leetcode/4.html">
            
                    
                    4.寻找两个有序数组的中位数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../leetcode/6.html">
            
                <a href="../leetcode/6.html">
            
                    
                    6.Z字形变换
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../leetcode/9.html">
            
                <a href="../leetcode/9.html">
            
                    
                    9.回文数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="../leetcode/11.html">
            
                <a href="../leetcode/11.html">
            
                    
                    11.盛最多水的容器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="../leetcode/12.html">
            
                <a href="../leetcode/12.html">
            
                    
                    12.整数转罗马数字
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="../leetcode/13.html">
            
                <a href="../leetcode/13.html">
            
                    
                    13.罗马数字转整数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10" data-path="../leetcode/14.html">
            
                <a href="../leetcode/14.html">
            
                    
                    14.最长公共前缀
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.11" data-path="../leetcode/322.html">
            
                <a href="../leetcode/322.html">
            
                    
                    322.零钱兑换
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.12" data-path="../leetcode/72.html">
            
                <a href="../leetcode/72.html">
            
                    
                    72.编辑距离
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../flutter/">
            
                <a href="../flutter/">
            
                    
                    Flutter从入门到放弃
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../flutter/dart1.html">
            
                <a href="../flutter/dart1.html">
            
                    
                    1.Dart语言(1)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../flutter/dart2.html">
            
                <a href="../flutter/dart2.html">
            
                    
                    2.Dart语言(2)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../flutter/widget1.html">
            
                <a href="../flutter/widget1.html">
            
                    
                    3.Flutter初始化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../flutter/containerText.html">
            
                <a href="../flutter/containerText.html">
            
                    
                    4.Container和Text组件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../flutter/image.html">
            
                <a href="../flutter/image.html">
            
                    
                    5.Image组件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../flutter/chapter2.html">
            
                <a href="../flutter/chapter2.html">
            
                    
                    6.Flutter 技术总结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../vue/">
            
                <a href="../vue/">
            
                    
                    Vue组件精讲
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../vue/1.html">
            
                <a href="../vue/1.html">
            
                    
                    1.provide/inject
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../vue/2.html">
            
                <a href="../vue/2.html">
            
                    
                    2.手动实现broadcast和dispatch方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="form.html">
            
                <a href="form.html">
            
                    
                    3.自己动手实现带校验的Form表单组件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="./">
            
                <a href="./">
            
                    
                    JavaScript进阶
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="proxy.html">
            
                <a href="proxy.html">
            
                    
                    1.Vue.js 3.0中的响应式
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.5.2" data-path="el.html">
            
                <a href="el.html">
            
                    
                    2.Element UI 源码初探
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="bind.html">
            
                <a href="bind.html">
            
                    
                    3.bind的模拟实现
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="proto.html">
            
                <a href="proto.html">
            
                    
                    4.JS原型和原型链
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="call.html">
            
                <a href="call.html">
            
                    
                    5.模拟实现call和apply
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="ui.html">
            
                <a href="ui.html">
            
                    
                    6.使用Vue cli3搭建组件库并发布到 npm
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7" data-path="microFE.html">
            
                <a href="microFE.html">
            
                    
                    7.记一次基于qiankun的微前端的改造
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8" data-path="git.html">
            
                <a href="git.html">
            
                    
                    8.Git的使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../vueLibrary/">
            
                <a href="../vueLibrary/">
            
                    
                    基于Vue的PC端的组件库
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../vueLibrary/1.html">
            
                <a href="../vueLibrary/1.html">
            
                    
                    1.环境搭建
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../life/">
            
                <a href="../life/">
            
                    
                    网事杂谈
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../life/1.html">
            
                <a href="../life/1.html">
            
                    
                    1.周杰伦专辑赏析--叶惠美
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../life/2.html">
            
                <a href="../life/2.html">
            
                    
                    2.周杰伦专辑赏析--七里香
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >2.Element UI 源码初探</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#element-ui-&#x6E90;&#x7801;&#x521D;&#x63A2;"><b></b>Element UI &#x6E90;&#x7801;&#x521D;&#x63A2;</a></li><ul><li><span class="title-icon "></span><a href="#&#x9700;&#x6C42;"><b></b>&#x9700;&#x6C42;</a></li><li><span class="title-icon "></span><a href="#&#x4E30;&#x5BCC;&#x7684;-feature"><b></b>&#x4E30;&#x5BCC;&#x7684; feature</a></li><ul><li><span class="title-icon "></span><a href="#&#x4E30;&#x5BCC;&#x7684;&#x7EC4;&#x4EF6;"><b></b>&#x4E30;&#x5BCC;&#x7684;&#x7EC4;&#x4EF6;</a></li><li><span class="title-icon "></span><a href="#&#x81EA;&#x5B9A;&#x4E49;&#x4E3B;&#x9898;"><b></b>&#x81EA;&#x5B9A;&#x4E49;&#x4E3B;&#x9898;</a></li><li><span class="title-icon "></span><a href="#&#x56FD;&#x9645;&#x5316;"><b></b>&#x56FD;&#x9645;&#x5316;</a></li></ul><li><span class="title-icon "></span><a href="#&#x6587;&#x6863;--demo"><b></b>&#x6587;&#x6863; &amp; demo</a></li><li><span class="title-icon "></span><a href="#&#x5B89;&#x88C5;--&#x5F15;&#x5165;"><b></b>&#x5B89;&#x88C5; &amp; &#x5F15;&#x5165;</a></li><li><span class="title-icon "></span><a href="#&#x5DE5;&#x7A0B;&#x5316;"><b></b>&#x5DE5;&#x7A0B;&#x5316;</a></li></ul></ul></div><a href="#element-ui-&#x6E90;&#x7801;&#x521D;&#x63A2;" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="element-ui-&#x6E90;&#x7801;&#x521D;&#x63A2;"><a name="element-ui-&#x6E90;&#x7801;&#x521D;&#x63A2;" class="anchor-navigation-ex-anchor" href="#element-ui-&#x6E90;&#x7801;&#x521D;&#x63A2;"><i class="fa fa-link" aria-hidden="true"></i></a>Element UI &#x6E90;&#x7801;&#x521D;&#x63A2;</h1>
<h2 id="&#x9700;&#x6C42;"><a name="&#x9700;&#x6C42;" class="anchor-navigation-ex-anchor" href="#&#x9700;&#x6C42;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x9700;&#x6C42;</h2>
<p>&#x5F53;&#x6211;&#x4EEC;&#x53BB;&#x5B9E;&#x73B0;&#x4E00;&#x4E2A;&#x7EC4;&#x4EF6;&#x5E93;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x5E76;&#x4E0D;&#x4F1A;&#x4E00;&#x4E0A;&#x6765;&#x5C31;&#x64B8;&#x7801;&#xFF0C;&#x800C;&#x662F;&#x628A;&#x5B83;&#x5F53;&#x505A;&#x4EA7;&#x54C1;&#x4E00;&#x6837;&#xFF0C;&#x601D;&#x8003;&#x4E00;&#x4E0B;&#x6211;&#x4EEC;&#x7684;&#x7EC4;&#x4EF6;&#x5E93;&#x7684;&#x9700;&#x6C42;&#x3002;&#x90A3;&#x4E48;&#x5BF9;&#x4E8E; element-ui&#xFF0C;&#x9664;&#x4E86;&#x57FA;&#x4E8E; Vue.js &#x6280;&#x672F;&#x6808;&#x5F00;&#x53D1;&#x7EC4;&#x4EF6;&#xFF0C;&#x5B83;&#x8FD8;&#x6709;&#x54EA;&#x4E9B;&#x65B9;&#x9762;&#x7684;&#x9700;&#x6C42;&#x5462;&#x3002;</p>
<ol>
<li>&#x4E30;&#x5BCC;&#x7684; feature&#xFF1A;&#x4E30;&#x5BCC;&#x7684;&#x7EC4;&#x4EF6;&#xFF0C;&#x81EA;&#x5B9A;&#x4E49;&#x4E3B;&#x9898;&#xFF0C;&#x56FD;&#x9645;&#x5316;</li>
<li>&#x6587;&#x6863; &amp; demo&#xFF1A;&#x63D0;&#x4F9B;&#x53CB;&#x597D;&#x7684;&#x6587;&#x6863;&#x548C; demo&#xFF0C;&#x7EF4;&#x62A4;&#x6210;&#x672C;&#x5C0F;&#xFF0C;&#x652F;&#x6301;&#x591A;&#x8BED;&#x8A00;&#x3002;</li>
<li>&#x5B89;&#x88C5; &amp; &#x5F15;&#x5165;&#xFF1A;&#x652F;&#x6301; npm &#x65B9;&#x5F0F;&#x548C; cdn &#x65B9;&#x5F0F;&#xFF0C;&#x5E76;&#x652F;&#x6301;&#x6309;&#x9700;&#x5F15;&#x5165;&#x3002;</li>
<li>&#x5DE5;&#x7A0B;&#x5316;&#xFF1A;&#x5F00;&#x53D1;&#xFF0C;&#x6D4B;&#x8BD5;&#xFF0C;&#x6784;&#x5EFA;&#xFF0C;&#x90E8;&#x7F72;&#xFF0C;&#x6301;&#x7EED;&#x96C6;&#x6210;&#x3002;</li>
</ol>
<p>&#x9700;&#x6C42;&#x6709;&#x4E86;&#xFF0C;&#x63A5;&#x4E0B;&#x6765;&#x5C31;&#x9700;&#x8981;&#x53BB;&#x601D;&#x8003;&#x5982;&#x4F55;&#x53BB;&#x5B9E;&#x73B0;&#xFF0C;&#x672C;&#x6587;&#x4F1A;&#x4F9D;&#x636E; element-ui 2.11.1 &#x7248;&#x672C;&#x7684;&#x6E90;&#x7801;&#x6765;&#x5206;&#x6790;&#x8FD9;&#x4E9B;&#x9700;&#x6C42;&#x662F;&#x5982;&#x4F55;&#x5B9E;&#x73B0;&#x7684;&#x3002;&#x5F53;&#x7136;&#xFF0C;element-ui &#x65E9;&#x671F;&#x4E00;&#x5B9A;&#x4E0D;&#x662F;&#x8FD9;&#x6837;&#x5B50;&#x7684;&#xFF0C;&#x6211;&#x4EEC;&#x5206;&#x6790;&#x7684;&#x8FD9;&#x4E2A;&#x7248;&#x672C;&#x5DF2;&#x7ECF;&#x662F;&#x7ECF;&#x8FC7;&#x5B83;&#x591A;&#x6B21;&#x8FED;&#x4EE3;&#x4F18;&#x5316;&#x540E;&#x7684;&#xFF0C;&#x5982;&#x679C;&#x4F60;&#x60F3;&#x53BB;&#x4E86;&#x89E3;&#x5B83;&#x7684;&#x53D1;&#x5C55;&#x5386;&#x7A0B;&#xFF0C;&#x53EF;&#x4EE5;&#x53BB; GitHub &#x641C;&#x7D22;&#x5B83;&#x7684;&#x5386;&#x53F2;&#x7248;&#x672C;&#x3002;</p>
<h2 id="&#x4E30;&#x5BCC;&#x7684;-feature"><a name="&#x4E30;&#x5BCC;&#x7684;-feature" class="anchor-navigation-ex-anchor" href="#&#x4E30;&#x5BCC;&#x7684;-feature"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4E30;&#x5BCC;&#x7684; feature</h2>
<h3 id="&#x4E30;&#x5BCC;&#x7684;&#x7EC4;&#x4EF6;"><a name="&#x4E30;&#x5BCC;&#x7684;&#x7EC4;&#x4EF6;" class="anchor-navigation-ex-anchor" href="#&#x4E30;&#x5BCC;&#x7684;&#x7EC4;&#x4EF6;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4E30;&#x5BCC;&#x7684;&#x7EC4;&#x4EF6;</h3>
<p>&#x7EC4;&#x4EF6;&#x5E93;&#x6700;&#x6838;&#x5FC3;&#x7684;&#x8FD8;&#x662F;&#x7EC4;&#x4EF6;&#xFF0C;&#x5148;&#x6765;&#x770B;&#x4E00;&#x4E0B; element-ui &#x7EC4;&#x4EF6;&#x7684;&#x8BBE;&#x8BA1;&#x539F;&#x5219;&#xFF1A;&#x4E00;&#x81F4;&#x3001;&#x53CD;&#x9988;&#x3001;&#x6548;&#x7387;&#x3001;&#x53EF;&#x63A7;&#x3002;&#x5177;&#x4F53;&#x7684;&#x89E3;&#x91CA;&#x5728;&#x5B98;&#x7F51;&#x6709;&#xFF0C;&#x6211;&#x5C31;&#x4E0D;&#x591A;&#x8D34;&#x4E86;&#xFF0C;&#x5728; element-ui &#x5F00;&#x53D1;&#x56E2;&#x961F;&#x80CC;&#x540E;&#xFF0C;&#x6709;&#x4E00;&#x4E2A;&#x5F3A;&#x5927;&#x7684;&#x8BBE;&#x8BA1;&#x56E2;&#x961F;&#xFF0C;&#x8FD9;&#x4E5F;&#x5F97;&#x76CA;&#x4E8E; element-ui &#x7684;&#x521B;&#x59CB;&#x4EBA; sofish &#x5728;&#x516C;&#x53F8;&#x7684;&#x8BDD;&#x8BED;&#x6743;&#x548C;&#x5730;&#x4F4D;&#xFF0C;&#x4E89;&#x53D6;&#x5230;&#x8FD9;&#x4E48;&#x597D;&#x7684;&#x8D44;&#x6E90;&#x3002;&#x6240;&#x4EE5; element-ui &#x7EC4;&#x4EF6;&#x7684;&#x5916;&#x578B;&#x3001;&#x914D;&#x8272;&#x3001;&#x4EA4;&#x4E92;&#x90FD;&#x505A;&#x7684;&#x975E;&#x5E38;&#x4E0D;&#x9519;&#x3002;</p>
<p>&#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x57FA;&#x7840;&#x7EC4;&#x4EF6;&#x5E93;&#xFF0C;&#x8FD8;&#x6709;&#x4E00;&#x4E2A;&#x5F88;&#x91CD;&#x8981;&#x7684;&#x65B9;&#x9762;&#x5C31;&#x662F;&#x7EC4;&#x4EF6;&#x79CD;&#x7C7B;&#x4E30;&#x5BCC;&#x3002;element-ui &#x5B98;&#x65B9;&#x76EE;&#x524D;&#x6709; 55 &#x4E2A;&#x7EC4;&#x4EF6;&#xFF0C;&#x5206;&#x6210;&#x4E86; 6 &#x5927;&#x7C7B;&#xFF0C;&#x5206;&#x522B;&#x662F;&#x57FA;&#x7840;&#x7EC4;&#x4EF6;&#x3001;&#x8868;&#x5355;&#x7C7B;&#x7EC4;&#x4EF6;&#x3001;&#x6570;&#x636E;&#x7C7B;&#x7EC4;&#x4EF6;&#x3001;&#x63D0;&#x793A;&#x7C7B;&#x7EC4;&#x4EF6;&#x3001;&#x5BFC;&#x822A;&#x7C7B;&#x7EC4;&#x4EF6;&#x548C;&#x5176;&#x5B83;&#x7C7B;&#x578B;&#x7EC4;&#x4EF6;&#x3002;&#x8FD9;&#x4E9B;&#x4E30;&#x5BCC;&#x7684;&#x57FA;&#x7840;&#x7EC4;&#x4EF6;&#x80FD;&#x5F88;&#x597D;&#x5730;&#x6EE1;&#x8DB3;&#x5927;&#x90E8;&#x5206; PC &#x7AEF; to B &#x4E1A;&#x52A1;&#x5F00;&#x53D1;&#x9700;&#x6C42;&#x3002;</p>
<blockquote>
<p>&#x5F00;&#x53D1;&#x8FD9;&#x4E48;&#x591A;&#x7EC4;&#x4EF6;&#xFF0C;&#x9700;&#x8981;&#x5927;&#x91CF;&#x7684;&#x65F6;&#x95F4;&#x548C;&#x7CBE;&#x529B;&#xFF0C;&#x6240;&#x4EE5;&#x8FD9;&#x91CC;&#x8981;&#x975E;&#x5E38;&#x611F;&#x8C22; element-ui &#x56E2;&#x961F;&#xFF0C;&#x4E3A;&#x6211;&#x4EEC;&#x63D0;&#x4F9B;&#x4E86;&#x8FD9;&#x4E9B;&#x57FA;&#x7840;&#x7EC4;&#x4EF6;&#xFF0C;&#x6211;&#x4EEC;&#x57FA;&#x4E8E;&#x5B83;&#x4EEC;&#x505A;&#x4E8C;&#x6B21;&#x5F00;&#x53D1;&#xFF0C;&#x8282;&#x7EA6;&#x4E86;&#x975E;&#x5E38;&#x591A;&#x7684;&#x65F6;&#x95F4;</p>
</blockquote>
<p>element-ui &#x7684;&#x7EC4;&#x4EF6;&#x6E90;&#x7801;&#x5728; packages &#x76EE;&#x5F55;&#x91CC;&#x7EF4;&#x62A4;&#xFF0C;&#x800C;&#x5E76;&#x4E0D;&#x5728; src &#x76EE;&#x5F55;&#x4E2D;&#x3002;&#x8FD9;&#x4E48;&#x505A;&#x5E76;&#x4E0D;&#x662F;&#x4E3A;&#x4E86;&#x8981;&#x91C7;&#x7528; monorepo&#xFF0C;&#x6211;&#x4E5F;&#x5E76;&#x6CA1;&#x6709;&#x627E;&#x5230; lerna &#x5305;&#x7BA1;&#x7406;&#x5DE5;&#x5177;&#xFF0C;&#x8FD9;&#x4E48;&#x505A;&#x7684;&#x76EE;&#x7684;&#x6211;&#x731C;&#x6D4B;&#x662F;&#x4E3A;&#x4E86;&#x8BA9;&#x6BCF;&#x4E2A;&#x7EC4;&#x4EF6;&#x53EF;&#x4EE5;&#x5355;&#x72EC;&#x6253;&#x5305;&#xFF0C;&#x652F;&#x6301;&#x6309;&#x9700;&#x5F15;&#x5165;&#x3002;&#x4F46;&#x5B9E;&#x9645;&#x4E0A;&#x60F3;&#x8FBE;&#x5230;&#x8FD9;&#x4E2A;&#x76EE;&#x7684;&#x4E5F;&#x5E76;&#x4E0D;&#x4E00;&#x5B9A;&#x9700;&#x8981;&#x8FD9;&#x4E48;&#x53BB;&#x7EC4;&#x7EC7;&#x7EF4;&#x62A4;&#x4EE3;&#x7801;&#xFF0C;&#x6211;&#x66F4;&#x63A8;&#x8350;&#x628A;&#x7EC4;&#x4EF6;&#x5E93;&#x4E2D;&#x7684;&#x7EC4;&#x4EF6;&#x4EE3;&#x7801;&#x653E;&#x5728; src/components &#x76EE;&#x5F55;&#x4E2D;&#x7EF4;&#x62A4;&#xFF0C;&#x7136;&#x540E;&#x901A;&#x8FC7;&#x4FEE;&#x6539; webpack &#x914D;&#x7F6E;&#x811A;&#x672C;&#x4E5F;&#x53EF;&#x4EE5;&#x505A;&#x5230;&#x6BCF;&#x4E2A;&#x7EC4;&#x4EF6;&#x5355;&#x72EC;&#x6253;&#x5305;&#x4EE5;&#x53CA;&#x652F;&#x6301;&#x6309;&#x9700;&#x5F15;&#x5165;&#xFF0C;&#x6E90;&#x7801;&#x653E;&#x5728; src &#x76EE;&#x5F55;&#x603B;&#x662F;&#x66F4;&#x5408;&#x7406;&#x7684;&#x3002;</p>
<h3 id="&#x81EA;&#x5B9A;&#x4E49;&#x4E3B;&#x9898;"><a name="&#x81EA;&#x5B9A;&#x4E49;&#x4E3B;&#x9898;" class="anchor-navigation-ex-anchor" href="#&#x81EA;&#x5B9A;&#x4E49;&#x4E3B;&#x9898;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x81EA;&#x5B9A;&#x4E49;&#x4E3B;&#x9898;</h3>
<p>element-ui &#x7684;&#x4E00;&#x5927;&#x7279;&#x8272;&#x662F;&#x652F;&#x6301;&#x81EA;&#x5B9A;&#x4E49;&#x4E3B;&#x9898;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x5728;&#x7EBF;&#x4E3B;&#x9898;&#x7F16;&#x8F91;&#x5668;&#xFF0C;&#x53EF;&#x4EE5;&#x4FEE;&#x6539;&#x5B9A;&#x5236; Element &#x6240;&#x6709;&#x5168;&#x5C40;&#x548C;&#x7EC4;&#x4EF6;&#x7684; Design Tokens&#xFF0C;&#x5E76;&#x53EF;&#x4EE5;&#x65B9;&#x4FBF;&#x5730;&#x5B9E;&#x65F6;&#x9884;&#x89C8;&#x6837;&#x5F0F;&#x6539;&#x53D8;&#x540E;&#x7684;&#x89C6;&#x89C9;&#x3002;&#x540C;&#x65F6;&#x5B83;&#x8FD8;&#x53EF;&#x4EE5;&#x57FA;&#x4E8E;&#x65B0;&#x7684;&#x5B9A;&#x5236;&#x6837;&#x5F0F;&#x751F;&#x6210;&#x5B8C;&#x6574;&#x7684;&#x6837;&#x5F0F;&#x6587;&#x4EF6;&#x5305;&#xFF0C;&#x4F9B;&#x76F4;&#x63A5;&#x4E0B;&#x8F7D;&#x4F7F;&#x7528;&#xFF0C;&#x90A3;&#x4E48;&#x5B83;&#x662F;&#x5982;&#x4F55;&#x505A;&#x5230;&#x8FD9;&#x70B9;&#x7684;&#x5462;&#xFF1F;</p>
<p>element-ui &#x7EC4;&#x4EF6;&#x7684;&#x6837;&#x5F0F;&#x3001;&#x516C;&#x5171;&#x6837;&#x5F0F;&#x90FD;&#x5728; packages/theme-chalk &#x6587;&#x4EF6;&#x4E2D;&#xFF0C;&#x5E76;&#x4E14;&#x5B83;&#x662F;&#x53EF;&#x4EE5;&#x72EC;&#x7ACB;&#x53D1;&#x5E03;&#x7684;&#x3002;element-ui &#x7EC4;&#x4EF6;&#x6837;&#x5F0F;&#x4E2D;&#x7684;&#x989C;&#x8272;&#x3001;&#x5B57;&#x4F53;&#x3001;&#x7EBF;&#x6761;&#x7B49;&#x7B49;&#x6837;&#x5F0F;&#x90FD;&#x662F;&#x901A;&#x8FC7;&#x53D8;&#x91CF;&#x7684;&#x65B9;&#x5F0F;&#x5F15;&#x5165;&#x7684;&#xFF0C;&#x5728; packages/theme-chalk/src/common/var.scss &#x4E2D;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x8FD9;&#x4E9B;&#x53D8;&#x91CF;&#x7684;&#x5B9A;&#x4E49;&#xFF0C;&#x8FD9;&#x6837;&#x5C31;&#x7ED9;&#x505A;&#x591A;&#x4E3B;&#x9898;&#x63D0;&#x4F9B;&#x4E86;&#x65B9;&#x4FBF;&#xFF0C;&#x56E0;&#x4E3A;&#x6211;&#x53EA;&#x8981;&#x4FEE;&#x6539;&#x8FD9;&#x4E9B;&#x53D8;&#x91CF;&#xFF0C;&#x5C31;&#x53EF;&#x4EE5;&#x5B9E;&#x73B0;&#x7EC4;&#x4EF6;&#x7684;&#x4E3B;&#x9898;&#x6539;&#x53D8;&#x3002;</p>
<p>&#x4E86;&#x89E3;&#x4E86;&#x57FA;&#x672C;&#x539F;&#x7406;&#xFF0C;&#x505A;&#x5728;&#x7EBF;&#x66FF;&#x6362;&#x4E3B;&#x9898;&#x4E5F;&#x5E76;&#x4E0D;&#x662F;&#x96BE;&#x4E8B;&#x4E86;&#xFF0C;&#x6211;&#x5E76;&#x4E0D;&#x4F1A;&#x8BE6;&#x7EC6;&#x53BB;&#x8BB2;&#x5728;&#x7EBF;&#x5B9A;&#x5236;&#x4E3B;&#x9898;&#x524D;&#x7AEF;&#x4EA4;&#x4E92;&#x90E8;&#x5206;&#xFF0C;&#x611F;&#x5174;&#x8DA3;&#x7684;&#x540C;&#x5B66;&#x53EF;&#x4EE5;&#x81EA;&#x5DF1;&#x53BB;&#x770B;&#x6E90;&#x7801;&#xFF0C;&#x90FD;&#x5728; examples &#x76EE;&#x5F55;&#x4E2D;&#xFF0C;&#x6211;&#x8FD9;&#x91CC;&#x53EA;&#x8BF4;&#x4E00;&#x4E0B;&#x672C;&#x8D28;&#x7684;&#x539F;&#x7406;&#x3002;
&#x60F3;&#x8981;&#x505A;&#x5230;&#x5728;&#x7EBF;&#x6362;&#x80A4;&#xFF0C;&#x5E76;&#x4E14;&#x5B9E;&#x65F6;&#x9884;&#x89C8;&#xFF0C;&#x9700;&#x8981;&#x501F;&#x52A9; server &#x7684;&#x5E2E;&#x52A9;&#xFF0C;&#x6BD4;&#x5982;&#x4E3B;&#x9898;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x4E00;&#x4E2A;&#x914D;&#x7F6E;&#x53BB;&#x7EF4;&#x62A4;&#xFF0C;&#x7528;&#x6237;&#x505A;&#x4E00;&#x7CFB;&#x5217;&#x64CD;&#x4F5C;&#x540E;&#xFF0C;&#x4F1A;&#x751F;&#x6210;&#x65B0;&#x7684;&#x4E3B;&#x9898;&#x914D;&#x7F6E;&#xFF0C;&#x628A;&#x8FD9;&#x4E2A;&#x914D;&#x7F6E;&#x901A;&#x8FC7;&#x63A5;&#x53E3;&#x63D0;&#x4EA4;&#x7684;&#x65B9;&#x5F0F;&#x544A;&#x8BC9; server&#xFF0C;&#x7136;&#x540E; server &#x4F1A;&#x6839;&#x636E;&#x8FD9;&#x4E2A;&#x914D;&#x7F6E;&#x505A;&#x8FD4;&#x56DE;&#x751F;&#x6210;&#x65B0;&#x7684; CSS&#xFF08;&#x5177;&#x4F53;&#x7684;&#x5B9E;&#x65BD;&#x7684;&#x65B9;&#x6848;&#x672A;&#x5F00;&#x6E90;&#xFF0C;&#x5927;&#x81F4;&#x4F1A;&#x505A;&#x4E00;&#x4E9B;&#x53D8;&#x91CF;&#x66FF;&#x6362;&#xFF0C;&#x7136;&#x540E;&#x7F16;&#x8BD1;&#xFF09;&#xFF0C;&#x65B0;&#x7684; CSS &#x7684;&#x6837;&#x5F0F;&#x5C31;&#x4F1A;&#x8986;&#x76D6;&#x9ED8;&#x8BA4;&#x7684;&#x6837;&#x5F0F;&#xFF0C;&#x8FBE;&#x5230;&#x4E86;&#x5207;&#x6362;&#x4E3B;&#x9898;&#x7684;&#x76EE;&#x7684;&#x3002;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x5728;&#x4E3B;&#x9898;&#x7F16;&#x8F91;&#x9875;&#x9762;&#x6253;&#x5F00;&#x7F51;&#x7EDC;&#x9762;&#x677F;&#xFF0C;&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x6709; 2 &#x4E2A; xhr &#x8BF7;&#x6C42;.</p>
<p>&#x5176;&#x4E2D;&#xFF0C;updateVarible &#x662F;&#x4E00;&#x4E2A; POST &#x8BF7;&#x6C42;&#xFF0C;&#x4ED6;&#x4F1A;&#x628A;&#x4F60;&#x4FEE;&#x6539;&#x7684;&#x7684;&#x4E3B;&#x9898;&#x914D;&#x7F6E;&#x63D0;&#x4EA4;&#x5230;&#x540E;&#x7AEF; server&#xFF0C;&#x63D0;&#x4EA4;&#x7684;&#x6570;&#x636E;&#x4F60;&#x53EF;&#x4EE5;&#x81EA;&#x5DF1;&#x53BB;&#x67E5;&#x770B;&#x5B83;&#x7684; Request Payload&#xFF0C;&#x8FD9;&#x4E2A; POST &#x8BF7;&#x6C42;&#x4F1A;&#x8FD4;&#x56DE;&#x4E00;&#x6BB5; CSS &#x6587;&#x672C;&#xFF0C;&#x7136;&#x540E;&#x4F1A;&#x52A8;&#x6001;&#x63D2;&#x5165;&#x5230; head &#x6807;&#x7B7E;&#x7684;&#x5E95;&#x90E8;&#xFF0C;&#x6765;&#x8986;&#x76D6;&#x9ED8;&#x8BA4;&#x6837;&#x5F0F;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x5BA1;&#x67E5;&#x5143;&#x7D20;&#x770B;&#x5230; head &#x5E95;&#x90E8;&#x4F1A;&#x52A8;&#x6001;&#x63D2;&#x5165;&#x4E00;&#x4E2A; id &#x4E3A; chalk-style &#x7684;&#x6807;&#x7B7E;&#x3002;</p>
<p>&#x76F8;&#x5173;&#x4EE3;&#x7801;&#x5728; examples/components/theme/loader/index.vue &#x4E2D;&#x3002;</p>
<pre class="language-"><code class="lang-javascript"> <span class="token function">onAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">triggertProgressBar</span><span class="token punctuation">(</span><span class="token boolean">true</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token keyword">const</span> time <span class="token operator">=</span> <span class="token operator">+</span><span class="token keyword">new</span> <span class="token class-name">Date</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token function">updateVars</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">.</span>userConfig<span class="token punctuation">)</span>
        <span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">res</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
          <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">applyStyle</span><span class="token punctuation">(</span>res<span class="token punctuation">,</span> time<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span><span class="token punctuation">)</span>
        <span class="token punctuation">.</span><span class="token function">catch</span><span class="token punctuation">(</span><span class="token parameter">err</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
          <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">onError</span><span class="token punctuation">(</span>err<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span><span class="token punctuation">)</span>
        <span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
          <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">triggertProgressBar</span><span class="token punctuation">(</span><span class="token boolean">false</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
    <span class="token function">applyStyle</span><span class="token punctuation">(</span><span class="token parameter">res<span class="token punctuation">,</span> time</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">if</span> <span class="token punctuation">(</span>time <span class="token operator">&lt;</span> <span class="token keyword">this</span><span class="token punctuation">.</span>lastApply<span class="token punctuation">)</span> <span class="token keyword">return</span><span class="token punctuation">;</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">updateDocs</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
        <span class="token function">updateDomHeadStyle</span><span class="token punctuation">(</span><span class="token string">&apos;chalk-style&apos;</span><span class="token punctuation">,</span> res<span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span>lastApply <span class="token operator">=</span> time<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
</code></pre>
<p>onAction &#x51FD;&#x6570;&#x4E2D;&#x7684; updateVars &#x5C31;&#x662F;&#x53BB;&#x53D1;&#x9001; POST &#x8BF7;&#x6C42;&#xFF0C;&#x800C; applyStyle &#x51FD;&#x6570;&#x5C31;&#x662F;&#x53BB;&#x4FEE;&#x6539;&#x548C;&#x8986;&#x76D6;&#x9ED8;&#x8BA4;&#x6837;&#x5F0F;&#xFF0C;updateDocs &#x51FD;&#x6570;&#x4F1A;&#x53BB;&#x66F4;&#x65B0;&#x9ED8;&#x8BA4;&#x4E3B;&#x9898;&#x989C;&#x8272;&#xFF0C;updateDomHeadStyle &#x6837;&#x5F0F;&#x4F1A;&#x6DFB;&#x52A0;&#x6216;&#x8005;&#x4FEE;&#x6539; id &#x4E3A; chalk-style &#x7684; style &#x6807;&#x7B7E;&#xFF0C;&#x76EE;&#x7684;&#x5C31;&#x662F;&#x8986;&#x76D6;&#x9ED8;&#x8BA4;&#x6837;&#x5F0F;&#xFF0C;&#x5E94;&#x7528;&#x65B0;&#x4E3B;&#x9898;&#x6837;&#x5F0F;&#x3002;</p>
<p>updateVars &#x8BF7;&#x6C42;&#x5728;&#x9875;&#x9762;&#x52A0;&#x8F7D;&#x7684;&#x65F6;&#x5019;&#x4F1A;&#x53D1;&#x8D77;&#xFF0C;&#x5728;&#x4F60;&#x4FEE;&#x6539;&#x5B8C;&#x4E3B;&#x9898;&#x914D;&#x7F6E;&#x540E;&#x4E5F;&#x4F1A;&#x53D1;&#x8D77;&#x3002;</p>
<p>&#x518D;&#x6765;&#x770B;&#x4E00;&#x4E0B; getVarible &#x8BF7;&#x6C42;&#xFF0C;&#x5B83;&#x662F;&#x4E00;&#x4E2A; GET &#x8BF7;&#x6C42;&#xFF0C;&#x8FD4;&#x56DE;&#x7684;&#x5185;&#x5BB9;&#x662F;&#x4E3B;&#x9898;&#x914D;&#x7F6E;&#x9875;&#x9762;&#x53F3;&#x4FA7;&#x914D;&#x7F6E;&#x9762;&#x677F;&#x7684;&#x6570;&#x636E;&#x6E90;.</p>
<p>&#x4E3B;&#x9898;&#x914D;&#x7F6E;&#x9762;&#x677F;&#x6839;&#x636E;&#x8BE5;&#x6570;&#x636E;&#x6E90;&#x751F;&#x6210;&#xFF0C;&#x5E76;&#x4E14;&#x5F53;&#x4F60;&#x53BB;&#x7F16;&#x8F91;&#x5176;&#x4E2D;&#x4E00;&#x9879;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x53C8;&#x4F1A;&#x53D1;&#x8D77; updateVars POST &#x8BF7;&#x6C42;&#xFF0C;&#x628A;&#x66F4;&#x65B0;&#x7684;&#x914D;&#x7F6E;&#x63D0;&#x4EA4;&#xFF0C;&#x7136;&#x540E;&#x540E;&#x7AEF;&#x4F1A;&#x8FD4;&#x56DE;&#x65B0;&#x7684; CSS &#x5E76;&#x5728;&#x524D;&#x7AEF;&#x751F;&#x6548;&#x3002;</p>
<p>&#x53E6;&#x5916;&#xFF0C;&#x7528;&#x6237;&#x4FEE;&#x6539;&#x7684;&#x914D;&#x7F6E;&#x8FD8;&#x5229;&#x7528;&#x4E86; localStorage &#x5728;&#x672C;&#x5730;&#x4FDD;&#x5B58;&#x4E86;&#x4E00;&#x4EFD;&#xFF0C;&#x8FD9;&#x6837;&#x7528;&#x6237;&#x6BCF;&#x6B21;&#x7F16;&#x8F91;&#x90FD;&#x53EF;&#x4EE5;&#x4FDD;&#x5B58;&#x4E00;&#x4EFD;&#x4E3B;&#x9898;&#xFF0C;&#x4E0B;&#x6B21;&#x4E5F;&#x53EF;&#x4EE5;&#x7EE7;&#x7EED;&#x57FA;&#x4E8E;&#x67D0;&#x4E2A;&#x4E3B;&#x9898;&#x7EE7;&#x7EED;&#x7F16;&#x8F91;&#x3002;</p>
<p>&#x4E0D;&#x8FC7;&#xFF0C;&#x8FD9;&#x4E48;&#x5B9E;&#x73B0;&#x591A;&#x4E3B;&#x9898;&#x4E5F;&#x5E76;&#x975E;&#x5B8C;&#x7F8E;&#xFF0C;&#x4E3A;&#x4E86;&#x7F16;&#x8BD1;&#x52A0;&#x901F;&#xFF0C;element-ui &#x628A;&#x6837;&#x5F0F;&#x90E8;&#x5206;&#x5355;&#x72EC;&#x62BD;&#x79BB;&#x51FA;&#x5355;&#x72EC;&#x7684;&#x6587;&#x4EF6;&#xFF0C;&#x8FD9;&#x6837;&#x7ED9;&#x5F00;&#x53D1;&#x7EC4;&#x4EF6;&#x7684;&#x540C;&#x5B66;&#x5E26;&#x6765;&#x5F88;&#x5927;&#x7684;&#x4E0D;&#x4FBF;&#xFF0C;&#x5F53;&#x4F60;&#x53BB;&#x7F16;&#x5199;&#x7EC4;&#x4EF6;&#x7684;&#x6837;&#x5F0F;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x9700;&#x8981;&#x5728;&#x591A;&#x4E2A;&#x6587;&#x4EF6;&#x4E2D;&#x6765;&#x56DE;&#x5207;&#x6362;&#xFF0C;&#x800C;&#x4E14;&#x8FD9;&#x6837;&#x4E5F;&#x4E0D;&#x7B26;&#x5408;&#x7EC4;&#x4EF6;&#x5C31;&#x8FD1;&#x7BA1;&#x7406;&#x7684;&#x539F;&#x5219;&#x3002;&#x4F46;&#x662F;&#x5982;&#x679C;&#x628A;&#x6837;&#x5F0F;&#x5199;&#x5728;&#x7EC4;&#x4EF6;&#x4E2D;&#xFF0C;server &#x7AEF;&#x53BB;&#x7F16;&#x8BD1;&#x751F;&#x6210;&#x5355;&#x72EC;&#x6837;&#x5F0F;&#x6587;&#x4EF6;&#x7684;&#x65F6;&#x95F4;&#x5C31;&#x4F1A;&#x589E;&#x957F;&#xFF08;&#x9700;&#x8981;&#x4ECE;&#x7EC4;&#x4EF6;&#x4E2D;&#x63D0;&#x53D6; CSS&#xFF09;&#xFF0C;&#x6240;&#x4EE5;&#x8FD9;&#x662F;&#x4E00;&#x4E2A;&#x9700;&#x8981;&#x6743;&#x8861;&#x7684;&#x95EE;&#x9898;&#x3002;</p>
<h3 id="&#x56FD;&#x9645;&#x5316;"><a name="&#x56FD;&#x9645;&#x5316;" class="anchor-navigation-ex-anchor" href="#&#x56FD;&#x9645;&#x5316;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x56FD;&#x9645;&#x5316;</h3>
<p>&#x8BF4;&#x5230; Vue &#x7684;&#x56FD;&#x9645;&#x5316;&#x65B9;&#x6848;&#xFF0C;&#x5927;&#x5BB6;&#x5F88;&#x5BB9;&#x6613;&#x4F1A;&#x8054;&#x60F3;&#x5230; vue-i18n &#x65B9;&#x6848;&#xFF0C;element-ui &#x5E76;&#x672A;&#x5F15;&#x5165; vue-i18n&#xFF0C;&#x4E0D;&#x8FC7;&#x5B83;&#x662F;&#x53EF;&#x4EE5;&#x5F88;&#x597D;&#x5730;&#x4E0E; vue-i18n &#x517C;&#x5BB9;&#x7684;&#x3002;</p>
<p>&#x6240;&#x6709;&#x7684;&#x56FD;&#x9645;&#x5316;&#x65B9;&#x6848;&#x90FD;&#x4F1A;&#x7528;&#x5230;&#x8BED;&#x8A00;&#x5305;&#xFF0C;&#x8BED;&#x8A00;&#x5305;&#x901A;&#x5E38;&#x4F1A;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A; JSON &#x683C;&#x5F0F;&#x7684;&#x6570;&#x636E;&#xFF0C;element-ui &#x7EC4;&#x4EF6;&#x5E93;&#x7684;&#x8BED;&#x8A00;&#x5305;&#x5728; src/locale/lang &#x76EE;&#x5F55;&#x4E0B;&#xFF0C;&#x4EE5;&#x82F1;&#x8BED;&#x8BED;&#x8A00;&#x5305;&#x4E3A;&#x4F8B;&#xFF1A;</p>
<pre class="language-"><code class="lang-javascript"><span class="token keyword">export</span> <span class="token keyword">default</span> <span class="token punctuation">{</span>
  el<span class="token punctuation">:</span> <span class="token punctuation">{</span>
    colorpicker<span class="token punctuation">:</span> <span class="token punctuation">{</span>
      confirm<span class="token punctuation">:</span> <span class="token string">&apos;OK&apos;</span><span class="token punctuation">,</span>
      clear<span class="token punctuation">:</span> <span class="token string">&apos;Clear&apos;</span>
    <span class="token punctuation">}</span>
    <span class="token comment">// ...</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x5728; packages/color-picker/src/components/picker-dropdown.vue &#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x5728;&#x6A21;&#x677F;&#x90E8;&#x5206;&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x8FD9;&#x4E2A;&#x8BED;&#x8A00;&#x5305;&#x7684;&#x4F7F;&#x7528;&#xFF1A;</p>
<pre class="language-"><code><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>el-button</span>
  <span class="token attr-name">size</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>mini<span class="token punctuation">&quot;</span></span>
  <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>text<span class="token punctuation">&quot;</span></span>
  <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>el-color-dropdown__link-btn<span class="token punctuation">&quot;</span></span>
  <span class="token attr-name">@click</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>$emit(&apos;clear&apos;)<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
   t(&apos;el.colorpicker.clear&apos;) 
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>el-button</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>el-button</span>
  <span class="token attr-name">plain</span>
  <span class="token attr-name">size</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>mini<span class="token punctuation">&quot;</span></span>
  <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>el-color-dropdown__btn<span class="token punctuation">&quot;</span></span>
  <span class="token attr-name">@click</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>confirmValue<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
  t(&apos;el.colorpicker.confirm&apos;) 
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>el-button</span><span class="token punctuation">&gt;</span></span>
</code></pre><p>&#x6A21;&#x677F;&#x4E2D;&#x7528;&#x5230;&#x7684; t &#x51FD;&#x6570;&#xFF0C;&#x5B83;&#x5B9A;&#x4E49;&#x5728; src/mixins/locale.js &#x4E2D;&#xFF1A;</p>
<pre class="language-"><code class="lang-javascript"><span class="token keyword">export</span> <span class="token keyword">default</span> <span class="token punctuation">{</span>
  methods<span class="token punctuation">:</span> <span class="token punctuation">{</span>
    <span class="token function">t</span><span class="token punctuation">(</span><span class="token parameter"><span class="token operator">...</span>args</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">return</span> <span class="token function">t</span><span class="token punctuation">.</span><span class="token function">apply</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">,</span> args<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<p>&#x5B9E;&#x9645;&#x4E0A;&#x662F;&#x5728; src/locale/index.js &#x4E2D;&#x5B9A;&#x4E49;&#x7684; t &#x51FD;&#x6570;&#xFF1A;</p>
<pre class="language-"><code class="lang-javascript"><span class="token keyword">export</span> <span class="token keyword">const</span> <span class="token function-variable function">t</span> <span class="token operator">=</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token parameter">path<span class="token punctuation">,</span> options</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">let</span> value <span class="token operator">=</span> <span class="token function">i18nHandler</span><span class="token punctuation">.</span><span class="token function">apply</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">,</span> arguments<span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token keyword">if</span> <span class="token punctuation">(</span>value <span class="token operator">!==</span> <span class="token keyword">null</span> <span class="token operator">&amp;&amp;</span> value <span class="token operator">!==</span> <span class="token keyword">undefined</span><span class="token punctuation">)</span> <span class="token keyword">return</span> value<span class="token punctuation">;</span>

  <span class="token keyword">const</span> array <span class="token operator">=</span> path<span class="token punctuation">.</span><span class="token function">split</span><span class="token punctuation">(</span><span class="token string">&apos;.&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token keyword">let</span> current <span class="token operator">=</span> lang<span class="token punctuation">;</span>

  <span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">let</span> i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">,</span> j <span class="token operator">=</span> array<span class="token punctuation">.</span>length<span class="token punctuation">;</span> i <span class="token operator">&lt;</span> j<span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">const</span> property <span class="token operator">=</span> array<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">;</span>
    value <span class="token operator">=</span> current<span class="token punctuation">[</span>property<span class="token punctuation">]</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>i <span class="token operator">===</span> j <span class="token operator">-</span> <span class="token number">1</span><span class="token punctuation">)</span> <span class="token keyword">return</span> <span class="token function">format</span><span class="token punctuation">(</span>value<span class="token punctuation">,</span> options<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>value<span class="token punctuation">)</span> <span class="token keyword">return</span> <span class="token string">&apos;&apos;</span><span class="token punctuation">;</span>
    current <span class="token operator">=</span> value<span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
  <span class="token keyword">return</span> <span class="token string">&apos;&apos;</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<p>&#x8FD9;&#x4E2A;&#x51FD;&#x6570;&#x662F;&#x6839;&#x636E;&#x4F20;&#x5165;&#x7684; path &#x8DEF;&#x5F84;&#xFF0C;&#x6BD4;&#x5982;&#x6211;&#x4EEC;&#x4F8B;&#x5B50;&#x4E2D;&#x7684; el.colorpicker.confirm&#xFF0C;&#x4ECE;&#x8BED;&#x8A00;&#x5305;&#x4E2D;&#x627E;&#x5230;&#x5BF9;&#x5E94;&#x7684;&#x6587;&#x6848;&#x3002;&#x5176;&#x4E2D; i18nHandler &#x662F;&#x4E00;&#x4E2A; i18n &#x7684;&#x5904;&#x7406;&#x51FD;&#x6570;&#xFF0C;&#x8FD9;&#x5757;&#x903B;&#x8F91;&#x5C31;&#x662F;&#x7528;&#x6765;&#x517C;&#x5BB9;&#x5916;&#x90E8;&#x7684; i18n &#x65B9;&#x6848;&#x5982; vue-i18n&#x3002;</p>
<pre class="language-"><code class="lang-javascript"><span class="token keyword">let</span> <span class="token function-variable function">i18nHandler</span> <span class="token operator">=</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">const</span> vuei18n <span class="token operator">=</span> Object<span class="token punctuation">.</span><span class="token function">getPrototypeOf</span><span class="token punctuation">(</span><span class="token keyword">this</span> <span class="token operator">||</span> Vue<span class="token punctuation">)</span><span class="token punctuation">.</span>$t<span class="token punctuation">;</span>
  <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token keyword">typeof</span> vuei18n <span class="token operator">===</span> <span class="token string">&apos;function&apos;</span> <span class="token operator">&amp;&amp;</span> <span class="token operator">!</span><span class="token operator">!</span>Vue<span class="token punctuation">.</span>locale<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>merged<span class="token punctuation">)</span> <span class="token punctuation">{</span>
      merged <span class="token operator">=</span> <span class="token boolean">true</span><span class="token punctuation">;</span>
      Vue<span class="token punctuation">.</span><span class="token function">locale</span><span class="token punctuation">(</span>
        Vue<span class="token punctuation">.</span>config<span class="token punctuation">.</span>lang<span class="token punctuation">,</span>
        <span class="token function">deepmerge</span><span class="token punctuation">(</span>lang<span class="token punctuation">,</span> Vue<span class="token punctuation">.</span><span class="token function">locale</span><span class="token punctuation">(</span>Vue<span class="token punctuation">.</span>config<span class="token punctuation">.</span>lang<span class="token punctuation">)</span> <span class="token operator">||</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> clone<span class="token punctuation">:</span> <span class="token boolean">true</span> <span class="token punctuation">}</span><span class="token punctuation">)</span>
      <span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">return</span> <span class="token function">vuei18n</span><span class="token punctuation">.</span><span class="token function">apply</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">,</span> arguments<span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>

<span class="token keyword">export</span> <span class="token keyword">const</span> <span class="token function-variable function">i18n</span> <span class="token operator">=</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token parameter">fn</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  i18nHandler <span class="token operator">=</span> fn <span class="token operator">||</span> i18nHandler<span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>

<span class="token keyword">export</span> <span class="token keyword">const</span> <span class="token function-variable function">use</span> <span class="token operator">=</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token parameter">l</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  lang <span class="token operator">=</span> l <span class="token operator">||</span> lang<span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<p>&#x53EF;&#x4EE5;&#x770B;&#x5230; i18nHandler &#x9ED8;&#x8BA4;&#x4F1A;&#x5C1D;&#x8BD5;&#x53BB;&#x627E; Vue &#x539F;&#x578B;&#x4E2D;&#x7684; t &#x51FD;&#x6570;&#xFF0C;&#x8FD9;&#x662F; vue-i18@5.x &#x7684;&#x5B9E;&#x73B0;&#xFF0C;&#x4F1A;&#x5728; Vue &#x7684;&#x539F;&#x578B;&#x4E0A;&#x6302;&#x8F7D; t &#x65B9;&#x6CD5;&#x3002;</p>
<p>&#x53E6;&#x5916;&#x5B83;&#x4E5F;&#x66B4;&#x9732;&#x4E86; i18n &#x65B9;&#x6CD5;&#xFF0C;&#x53EF;&#x4EE5;&#x5916;&#x90E8;&#x4F20;&#x5165;&#x5176;&#x5B83;&#x7684; i18n &#x65B9;&#x6CD5;&#xFF0C;&#x8986;&#x76D6; i18nHandler&#x3002;</p>
<p>&#x5982;&#x679C;&#x6CA1;&#x6709;&#x5916;&#x90E8;&#x63D0;&#x4F9B;&#x7684; i18n &#x65B9;&#x6CD5;&#xFF0C;&#x90A3;&#x4E48;&#x5C31;&#x76F4;&#x63A5;&#x627E;&#x5230;&#x5F53;&#x524D;&#x7684;&#x8BED;&#x8A00;&#x5305; let current = lang;&#xFF0C;&#x63A5;&#x4E0B;&#x6765;&#x7684;&#x903B;&#x8F91;&#x5C31;&#x662F;&#x4ECE;&#x8FD9;&#x4E2A;&#x8BED;&#x8A00;&#x5305;&#x5BF9;&#x8C61;&#x4E2D;&#x8BFB;&#x5230;&#x5BF9;&#x5E94;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#x503C;&#xFF0C;&#x5F53;&#x7136;&#x5982;&#x679C;&#x5B57;&#x7B26;&#x4E32;&#x9700;&#x8981;&#x683C;&#x5F0F;&#x5316;&#x5219;&#x8C03;&#x7528; format &#x51FD;&#x6570;&#xFF0C;&#x8FD9;&#x5757;&#x903B;&#x8F91;&#x540C;&#x5B66;&#x4EEC;&#x611F;&#x5174;&#x8DA3;&#x53EF;&#x4EE5;&#x81EA;&#x5DF1;&#x770B;&#x3002;</p>
<p>&#x56E0;&#x6B64;&#x5728;&#x4F7F;&#x7528;&#x5BF9;&#x5E94;&#x7684;&#x8BED;&#x8A00;&#x5305;&#x7684;&#x65F6;&#x5019;&#x4E00;&#x5B9A;&#x8981;&#x6CE8;&#x518C;&#xFF1A;</p>
<pre class="language-"><code class="lang-javascript"><span class="token keyword">import</span> lang <span class="token keyword">from</span> <span class="token string">&apos;element-ui/lib/locale/lang/en&apos;</span>
<span class="token keyword">import</span> locale <span class="token keyword">from</span> <span class="token string">&apos;element-ui/lib/locale&apos;</span>

<span class="token comment">// &#x8BBE;&#x7F6E;&#x8BED;&#x8A00;</span>
locale<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>lang<span class="token punctuation">)</span>
</code></pre>
<p>&#x8FD9;&#x6837;&#x5C31;&#x6CE8;&#x518C;&#x4E86;&#x82F1;&#x6587;&#x8BED;&#x8A00;&#x5305;&#xFF0C;&#x5728;&#x6A21;&#x677F;&#x4E2D;&#x5C31;&#x53EF;&#x4EE5;&#x6B63;&#x5E38;&#x4F7F;&#x7528;&#x5E76;&#x627E;&#x5230;&#x5BF9;&#x5E94;&#x7684;&#x8BED;&#x8A00;&#x4E86;&#x3002;</p>
<h2 id="&#x6587;&#x6863;--demo"><a name="&#x6587;&#x6863;--demo" class="anchor-navigation-ex-anchor" href="#&#x6587;&#x6863;--demo"><i class="fa fa-link" aria-hidden="true"></i></a>&#x6587;&#x6863; &amp; demo</h2>
<p>&#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x4F18;&#x79C0;&#x7684;&#x5F00;&#x6E90;&#x7EC4;&#x4EF6;&#x5E93;&#xFF0C;&#x53CB;&#x597D;&#x7684;&#x6587;&#x6863;&#x548C; demo &#x662F;&#x5FC5;&#x4E0D;&#x53EF;&#x5C11;&#x7684;&#xFF0C;&#x5B83;&#x4E5F;&#x80FD;&#x5E2E;&#x4F60;&#x62DB;&#x63FD;&#x5230;&#x4E0D;&#x5C11;&#x7528;&#x6237;&#x3002;&#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x7EC4;&#x4EF6;&#x5E93;&#x7684;&#x5F00;&#x53D1;&#x8005;&#x548C;&#x7EF4;&#x62A4;&#x8005;&#xFF0C;&#x4E5F;&#x5E0C;&#x671B;&#x7528;&#x6700;&#x5C0F;&#x7684;&#x6210;&#x672C;&#x6765;&#x7EF4;&#x62A4;&#x6587;&#x6863;&#x548C; demo&#x3002;</p>
<p>element-ui &#x7684;&#x6587;&#x6863;&#x548C; demo &#x662F;&#x878D;&#x4E3A;&#x4E00;&#x4F53;&#x7684;&#xFF0C;&#x6211;&#x4EEC;&#x6253;&#x5F00;&#x5B83;&#x7684;&#x6587;&#x6863;&#xFF0C;&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x6587;&#x6863;&#x4E0D;&#x4EC5;&#x4ECB;&#x7ECD;&#x4E86;&#x6BCF;&#x4E2A;&#x7EC4;&#x4EF6;&#x7684;&#x4F7F;&#x7528;&#x65B9;&#x5F0F;&#xFF0C;&#x8FD8;&#x5C55;&#x793A;&#x4E86;&#x7EC4;&#x4EF6;&#x7684;&#x5404;&#x79CD;&#x793A;&#x4F8B;&#xFF0C;&#x5E76;&#x4E14;&#x8FD8;&#x53EF;&#x4EE5;&#x6E05;&#x695A;&#x5730;&#x770B;&#x5230;&#x6BCF;&#x4E2A;&#x793A;&#x4F8B;&#x7684;&#x6E90;&#x7801;&#xFF0C;&#x5BF9;&#x7528;&#x6237;&#x800C;&#x8A00;&#x975E;&#x5E38;&#x53CB;&#x597D;&#x3002;&#x90A3;&#x4E48; element-ui &#x5185;&#x90E8;&#x662F;&#x5982;&#x4F55;&#x53BB;&#x7F16;&#x5199;&#x8FD9;&#x4E9B; demo &#x548C;&#x6587;&#x6863;&#x7684;&#x5462;&#xFF1F;&#x5B9E;&#x9645;&#x4E0A;&#xFF0C;&#x6BCF;&#x4E2A;&#x7EC4;&#x4EF6;&#x7684;&#x6587;&#x6863;&#x548C; demo &#x90FD;&#x662F;&#x901A;&#x8FC7;&#x4E00;&#x4E2A;&#x5355;&#x72EC;&#x7684; .md &#x6587;&#x4EF6;&#x751F;&#x6210;&#x7684;&#xFF0C;&#x90A3;&#x4E48;&#x5B83;&#x53C8;&#x662F;&#x5982;&#x4F55;&#x505A;&#x5230;&#x8FD9;&#x70B9;&#x7684;&#x5462;&#xFF1F;</p>
<p>element-ui &#x7684; demo &#x6E90;&#x7801;&#x90FD;&#x5728; examples &#x76EE;&#x5F55;&#x4E2D;&#x7EF4;&#x62A4;&#xFF0C;&#x5F53;&#x6211;&#x4EEC;&#x5728; element-ui &#x5DE5;&#x7A0B;&#x4E0B;&#x8FD0;&#x884C; npm run dev &#x7684;&#x65F6;&#x5019;&#xFF0C;&#x4F1A;&#x542F;&#x52A8;&#x5B83;&#x7684;&#x5F00;&#x53D1;&#x8C03;&#x8BD5;&#x6A21;&#x5F0F;&#xFF0C;&#x5E76;&#x4E14;&#x8FD0;&#x884C;&#x5B98;&#x65B9;&#x6587;&#x6863;&#x548C; demo&#x3002;</p>
<p>&#x770B;&#x4E00;&#x4E0B; npm scripts&#xFF1A;</p>
<pre class="language-"><code>&quot;scripts&quot;: {
    &quot;bootstrap&quot;: &quot;yarn || npm i&quot;,
    &quot;build:file&quot;: &quot;node build/bin/iconInit.js &amp; node build/bin/build-entry.js &amp; node build/bin/i18n.js &amp; node build/bin/version.js&quot;,
    &quot;dev&quot;: &quot;npm run bootstrap &amp;&amp; npm run build:file &amp;&amp; cross-env NODE_ENV=development webpack-dev-server --config build/webpack.demo.js &amp; node build/bin/template.js&quot;,
}
</code></pre><p>&#x6211;&#x4EEC;&#x7701;&#x7565;&#x4E86;&#x5176;&#x5B83;&#x7684; scripts&#xFF0C;&#x91CD;&#x70B9;&#x770B; dev &#x548C;&#x76F8;&#x5173;&#x7684;&#x51E0;&#x4E2A;&#x547D;&#x4EE4;&#xFF0C;&#x5176;&#x4E2D; bootstrap &#x7684;&#x4F5C;&#x7528;&#x662F;&#x5B89;&#x88C5;&#x4F9D;&#x8D56;&#xFF0C;build:file &#x7684;&#x4F5C;&#x7528;&#x662F;&#x8FD0;&#x884C; build &#x76EE;&#x5F55;&#x4E0B;&#x51E0;&#x4E2A;&#x547D;&#x4EE4;&#xFF0C;&#x5305;&#x62EC;&#x5BF9; icon&#x3001;entry&#x3001;i18n&#x3001;version &#x7B49;&#x521D;&#x59CB;&#x5316;&#x3002;&#x5728;&#x6267;&#x884C;&#x5B8C; bootstrap &#x548C; build:file &#x540E;&#xFF0C;&#x901A;&#x8FC7; webpack-dev-server &#x8FD0;&#x884C; build/webpack.demo.js&#xFF0C;&#x8FD9;&#x4E2A;&#x662F;&#x91CD;&#x70B9;&#xFF0C;&#x6211;&#x4EEC;&#x6765;&#x770B;&#x4E00;&#x4E0B;&#x8FD9;&#x4E2A; webpack &#x7684;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x3002;</p>
<pre class="language-"><code class="lang-javascript"><span class="token keyword">const</span> webpackConfig <span class="token operator">=</span> <span class="token punctuation">{</span>
  mode<span class="token punctuation">:</span> process<span class="token punctuation">.</span>env<span class="token punctuation">.</span><span class="token constant">NODE_ENV</span><span class="token punctuation">,</span>
  entry<span class="token punctuation">:</span> isProd <span class="token operator">?</span> <span class="token punctuation">{</span>
    docs<span class="token punctuation">:</span> <span class="token string">&apos;./examples/entry.js&apos;</span><span class="token punctuation">,</span>
    <span class="token string">&apos;element-ui&apos;</span><span class="token punctuation">:</span> <span class="token string">&apos;./src/index.js&apos;</span>
  <span class="token punctuation">}</span> <span class="token punctuation">:</span> <span class="token punctuation">(</span>isPlay <span class="token operator">?</span> <span class="token string">&apos;./examples/play.js&apos;</span> <span class="token punctuation">:</span> <span class="token string">&apos;./examples/entry.js&apos;</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
  output<span class="token punctuation">:</span> <span class="token punctuation">{</span>
    path<span class="token punctuation">:</span> path<span class="token punctuation">.</span><span class="token function">resolve</span><span class="token punctuation">(</span>process<span class="token punctuation">.</span><span class="token function">cwd</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token string">&apos;./examples/element-ui/&apos;</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    publicPath<span class="token punctuation">:</span> process<span class="token punctuation">.</span>env<span class="token punctuation">.</span><span class="token constant">CI_ENV</span> <span class="token operator">||</span> <span class="token string">&apos;&apos;</span><span class="token punctuation">,</span>
    filename<span class="token punctuation">:</span> <span class="token string">&apos;[name].[hash:7].js&apos;</span><span class="token punctuation">,</span>
    chunkFilename<span class="token punctuation">:</span> isProd <span class="token operator">?</span> <span class="token string">&apos;[name].[hash:7].js&apos;</span> <span class="token punctuation">:</span> <span class="token string">&apos;[name].js&apos;</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
  resolve<span class="token punctuation">:</span> <span class="token punctuation">{</span>
    extensions<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">&apos;.js&apos;</span><span class="token punctuation">,</span> <span class="token string">&apos;.vue&apos;</span><span class="token punctuation">,</span> <span class="token string">&apos;.json&apos;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
    alias<span class="token punctuation">:</span> config<span class="token punctuation">.</span>alias<span class="token punctuation">,</span>
    modules<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">&apos;node_modules&apos;</span><span class="token punctuation">]</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
  devServer<span class="token punctuation">:</span> <span class="token punctuation">{</span>
    host<span class="token punctuation">:</span> <span class="token string">&apos;0.0.0.0&apos;</span><span class="token punctuation">,</span>
    port<span class="token punctuation">:</span> <span class="token number">8085</span><span class="token punctuation">,</span>
    publicPath<span class="token punctuation">:</span> <span class="token string">&apos;/&apos;</span><span class="token punctuation">,</span>
    hot<span class="token punctuation">:</span> <span class="token boolean">true</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
  module<span class="token punctuation">:</span> <span class="token punctuation">{</span>
    rules<span class="token punctuation">:</span> <span class="token punctuation">[</span>
      <span class="token punctuation">{</span>
        test<span class="token punctuation">:</span> <span class="token regex">/\.vue$/</span><span class="token punctuation">,</span>
        loader<span class="token punctuation">:</span> <span class="token string">&apos;vue-loader&apos;</span><span class="token punctuation">,</span>
        options<span class="token punctuation">:</span> <span class="token punctuation">{</span>
          compilerOptions<span class="token punctuation">:</span> <span class="token punctuation">{</span>
            preserveWhitespace<span class="token punctuation">:</span> <span class="token boolean">false</span>
          <span class="token punctuation">}</span>
        <span class="token punctuation">}</span>
      <span class="token punctuation">}</span><span class="token punctuation">,</span>
      <span class="token punctuation">{</span>
        test<span class="token punctuation">:</span> <span class="token regex">/\.md$/</span><span class="token punctuation">,</span>
        use<span class="token punctuation">:</span> <span class="token punctuation">[</span>
          <span class="token punctuation">{</span>
            loader<span class="token punctuation">:</span> <span class="token string">&apos;vue-loader&apos;</span><span class="token punctuation">,</span>
            options<span class="token punctuation">:</span> <span class="token punctuation">{</span>
              compilerOptions<span class="token punctuation">:</span> <span class="token punctuation">{</span>
                preserveWhitespace<span class="token punctuation">:</span> <span class="token boolean">false</span>
              <span class="token punctuation">}</span>
            <span class="token punctuation">}</span>
          <span class="token punctuation">}</span><span class="token punctuation">,</span>
          <span class="token punctuation">{</span>
            loader<span class="token punctuation">:</span> path<span class="token punctuation">.</span><span class="token function">resolve</span><span class="token punctuation">(</span>__dirname<span class="token punctuation">,</span> <span class="token string">&apos;./md-loader/index.js&apos;</span><span class="token punctuation">)</span>
          <span class="token punctuation">}</span>
        <span class="token punctuation">]</span>
      <span class="token punctuation">}</span>
    <span class="token punctuation">]</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<p>&#x7531;&#x4E8E;&#x6574;&#x4E2A;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x5185;&#x5BB9;&#x6BD4;&#x8F83;&#x957F;&#xFF0C;&#x6211;&#x53EA;&#x4FDD;&#x7559;&#x4E86;&#x91CD;&#x70B9;&#x7684;&#x90E8;&#x5206;&#xFF0C;&#x91CD;&#x70B9;&#x770B;&#x4E00;&#x4E0B; entry &#x548C; module &#x4E0B;&#x7684; rules&#x3002;</p>
<p>element-ui &#x5B98;&#x7F51;&#x672C;&#x8D28;&#x4E0A;&#x5C31;&#x662F;&#x4E00;&#x4E2A;&#x7528; vue &#x5F00;&#x53D1;&#x7684;&#x5E94;&#x7528;&#xFF0C;&#x5F53;&#x6211;&#x4EEC;&#x8FD0;&#x884C; npm run dev &#x7684;&#x65F6;&#x5019;&#xFF0C;&#x5165;&#x53E3;&#x6587;&#x4EF6;&#x662F; examples &#x76EE;&#x5F55;&#x4E0B;&#x7684; entry.js&#xFF1A;</p>
<pre class="language-"><code class="lang-javascript"><span class="token keyword">import</span> Vue <span class="token keyword">from</span> <span class="token string">&apos;vue&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> entry <span class="token keyword">from</span> <span class="token string">&apos;./app&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> VueRouter <span class="token keyword">from</span> <span class="token string">&apos;vue-router&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> Element <span class="token keyword">from</span> <span class="token string">&apos;main/index.js&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> hljs <span class="token keyword">from</span> <span class="token string">&apos;highlight.js&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> routes <span class="token keyword">from</span> <span class="token string">&apos;./route.config&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> demoBlock <span class="token keyword">from</span> <span class="token string">&apos;./components/demo-block&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> MainFooter <span class="token keyword">from</span> <span class="token string">&apos;./components/footer&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> MainHeader <span class="token keyword">from</span> <span class="token string">&apos;./components/header&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> SideNav <span class="token keyword">from</span> <span class="token string">&apos;./components/side-nav&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> FooterNav <span class="token keyword">from</span> <span class="token string">&apos;./components/footer-nav&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> title <span class="token keyword">from</span> <span class="token string">&apos;./i18n/title&apos;</span><span class="token punctuation">;</span>

<span class="token keyword">import</span> <span class="token string">&apos;packages/theme-chalk/src/index.scss&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> <span class="token string">&apos;./demo-styles/index.scss&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> <span class="token string">&apos;./assets/styles/common.css&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> <span class="token string">&apos;./assets/styles/fonts/style.css&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> icon <span class="token keyword">from</span> <span class="token string">&apos;./icon.json&apos;</span><span class="token punctuation">;</span>

Vue<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>Element<span class="token punctuation">)</span><span class="token punctuation">;</span>
Vue<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>VueRouter<span class="token punctuation">)</span><span class="token punctuation">;</span>
Vue<span class="token punctuation">.</span><span class="token function">component</span><span class="token punctuation">(</span><span class="token string">&apos;demo-block&apos;</span><span class="token punctuation">,</span> demoBlock<span class="token punctuation">)</span><span class="token punctuation">;</span>
Vue<span class="token punctuation">.</span><span class="token function">component</span><span class="token punctuation">(</span><span class="token string">&apos;main-footer&apos;</span><span class="token punctuation">,</span> MainFooter<span class="token punctuation">)</span><span class="token punctuation">;</span>
Vue<span class="token punctuation">.</span><span class="token function">component</span><span class="token punctuation">(</span><span class="token string">&apos;main-header&apos;</span><span class="token punctuation">,</span> MainHeader<span class="token punctuation">)</span><span class="token punctuation">;</span>
Vue<span class="token punctuation">.</span><span class="token function">component</span><span class="token punctuation">(</span><span class="token string">&apos;side-nav&apos;</span><span class="token punctuation">,</span> SideNav<span class="token punctuation">)</span><span class="token punctuation">;</span>
Vue<span class="token punctuation">.</span><span class="token function">component</span><span class="token punctuation">(</span><span class="token string">&apos;footer-nav&apos;</span><span class="token punctuation">,</span> FooterNav<span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token keyword">const</span> globalEle <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Vue</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
  data<span class="token punctuation">:</span> <span class="token punctuation">{</span> $isEle<span class="token punctuation">:</span> <span class="token boolean">false</span> <span class="token punctuation">}</span> <span class="token comment">// &#x662F;&#x5426; ele &#x7528;&#x6237;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

Vue<span class="token punctuation">.</span><span class="token function">mixin</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
  computed<span class="token punctuation">:</span> <span class="token punctuation">{</span>
    $isEle<span class="token punctuation">:</span> <span class="token punctuation">{</span>
      <span class="token function-variable function">get</span><span class="token punctuation">:</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">(</span>globalEle<span class="token punctuation">.</span>$data<span class="token punctuation">.</span>$isEle<span class="token punctuation">)</span><span class="token punctuation">,</span>
      <span class="token function-variable function">set</span><span class="token punctuation">:</span> <span class="token punctuation">(</span><span class="token parameter">data</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>globalEle<span class="token punctuation">.</span>$data<span class="token punctuation">.</span>$isEle <span class="token operator">=</span> data<span class="token punctuation">;</span><span class="token punctuation">}</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token class-name">Vue</span><span class="token punctuation">.</span>prototype<span class="token punctuation">.</span>$icon <span class="token operator">=</span> icon<span class="token punctuation">;</span> <span class="token comment">// Icon &#x5217;&#x8868;&#x9875;&#x7528;</span>

<span class="token keyword">const</span> router <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">VueRouter</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
  mode<span class="token punctuation">:</span> <span class="token string">&apos;hash&apos;</span><span class="token punctuation">,</span>
  base<span class="token punctuation">:</span> __dirname<span class="token punctuation">,</span>
  routes
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

router<span class="token punctuation">.</span><span class="token function">afterEach</span><span class="token punctuation">(</span><span class="token parameter">route</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
  <span class="token comment">// https://github.com/highlightjs/highlight.js/issues/909#issuecomment-131686186</span>
  Vue<span class="token punctuation">.</span><span class="token function">nextTick</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
    <span class="token keyword">const</span> blocks <span class="token operator">=</span> document<span class="token punctuation">.</span><span class="token function">querySelectorAll</span><span class="token punctuation">(</span><span class="token string">&apos;pre code:not(.hljs)&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token class-name">Array</span><span class="token punctuation">.</span>prototype<span class="token punctuation">.</span><span class="token function">forEach</span><span class="token punctuation">.</span><span class="token function">call</span><span class="token punctuation">(</span>blocks<span class="token punctuation">,</span> hljs<span class="token punctuation">.</span>highlightBlock<span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token keyword">const</span> data <span class="token operator">=</span> title<span class="token punctuation">[</span>route<span class="token punctuation">.</span>meta<span class="token punctuation">.</span>lang<span class="token punctuation">]</span><span class="token punctuation">;</span>
  <span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">let</span> val <span class="token keyword">in</span> data<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token keyword">new</span> <span class="token class-name">RegExp</span><span class="token punctuation">(</span><span class="token string">&apos;^&apos;</span> <span class="token operator">+</span> val<span class="token punctuation">,</span> <span class="token string">&apos;g&apos;</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">test</span><span class="token punctuation">(</span>route<span class="token punctuation">.</span>name<span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      document<span class="token punctuation">.</span>title <span class="token operator">=</span> data<span class="token punctuation">[</span>val<span class="token punctuation">]</span><span class="token punctuation">;</span>
      <span class="token keyword">return</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>
  document<span class="token punctuation">.</span>title <span class="token operator">=</span> <span class="token string">&apos;Element&apos;</span><span class="token punctuation">;</span>
  <span class="token function">ga</span><span class="token punctuation">(</span><span class="token string">&apos;send&apos;</span><span class="token punctuation">,</span> <span class="token string">&apos;event&apos;</span><span class="token punctuation">,</span> <span class="token string">&apos;PageView&apos;</span><span class="token punctuation">,</span> route<span class="token punctuation">.</span>name<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token keyword">new</span> <span class="token class-name">Vue</span><span class="token punctuation">(</span><span class="token punctuation">{</span> <span class="token comment">// eslint-disable-line</span>
  <span class="token operator">...</span>entry<span class="token punctuation">,</span>
  router
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">$mount</span><span class="token punctuation">(</span><span class="token string">&apos;#app&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<p>&#x5165;&#x53E3;&#x6587;&#x4EF6;&#x505A;&#x7684;&#x4E8B;&#x60C5;&#x5F88;&#x7B80;&#x5355;&#xFF0C;&#x5168;&#x5F15;&#x5165;&#x7684;&#x65B9;&#x5F0F;&#x6CE8;&#x518C;&#x4E86; element-ui &#x7EC4;&#x4EF6;&#x5E93;&#xFF0C;&#x6CE8;&#x518C;&#x4E86;&#x4E00;&#x4E9B;&#x5B98;&#x7F51;&#x7528;&#x5230;&#x7684;&#x7EC4;&#x4EF6;&#xFF0C;&#x6CE8;&#x518C;&#x4E86;&#x8DEF;&#x7531;&#x4EE5;&#x53CA;&#x8DEF;&#x7531;&#x7684;&#x5168;&#x5C40;&#x94A9;&#x5B50;&#x51FD;&#x6570;&#x3002;</p>
<p>&#x8FD9;&#x91CC;&#x6211;&#x4EEC;&#x8981;&#x91CD;&#x70B9;&#x5173;&#x6CE8;&#x8DEF;&#x7531;&#x90E8;&#x5206;&#xFF0C;&#x8DEF;&#x7531;&#x7684;&#x914D;&#x7F6E;&#x90FD;&#x5728; examples/route.config.js &#x4E2D;&#xFF1A;</p>
<pre class="language-"><code class="lang-javascript"><span class="token keyword">import</span> navConfig <span class="token keyword">from</span> <span class="token string">&apos;./nav.config&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> langs <span class="token keyword">from</span> <span class="token string">&apos;./i18n/route&apos;</span><span class="token punctuation">;</span>

<span class="token keyword">const</span> <span class="token constant">LOAD_MAP</span> <span class="token operator">=</span> <span class="token punctuation">{</span>
  <span class="token string">&apos;zh-CN&apos;</span><span class="token punctuation">:</span> <span class="token parameter">name</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token parameter">r</span> <span class="token operator">=&gt;</span> require<span class="token punctuation">.</span><span class="token function">ensure</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span>
      <span class="token function">r</span><span class="token punctuation">(</span><span class="token function">require</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">./pages/zh-CN/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>name<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">.vue</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token string">&apos;zh-CN&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token string">&apos;en-US&apos;</span><span class="token punctuation">:</span> <span class="token parameter">name</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token parameter">r</span> <span class="token operator">=&gt;</span> require<span class="token punctuation">.</span><span class="token function">ensure</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span>
      <span class="token function">r</span><span class="token punctuation">(</span><span class="token function">require</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">./pages/en-US/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>name<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">.vue</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token string">&apos;en-US&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token string">&apos;es&apos;</span><span class="token punctuation">:</span> <span class="token parameter">name</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token parameter">r</span> <span class="token operator">=&gt;</span> require<span class="token punctuation">.</span><span class="token function">ensure</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span>
      <span class="token function">r</span><span class="token punctuation">(</span><span class="token function">require</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">./pages/es/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>name<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">.vue</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token string">&apos;es&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token string">&apos;fr-FR&apos;</span><span class="token punctuation">:</span> <span class="token parameter">name</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token parameter">r</span> <span class="token operator">=&gt;</span> require<span class="token punctuation">.</span><span class="token function">ensure</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span>
      <span class="token function">r</span><span class="token punctuation">(</span><span class="token function">require</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">./pages/fr-FR/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>name<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">.vue</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token string">&apos;fr-FR&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>

<span class="token keyword">const</span> <span class="token function-variable function">load</span> <span class="token operator">=</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token parameter">lang<span class="token punctuation">,</span> path</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">return</span> <span class="token constant">LOAD_MAP</span><span class="token punctuation">[</span>lang<span class="token punctuation">]</span><span class="token punctuation">(</span>path<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>

<span class="token keyword">const</span> <span class="token constant">LOAD_DOCS_MAP</span> <span class="token operator">=</span> <span class="token punctuation">{</span>
  <span class="token string">&apos;zh-CN&apos;</span><span class="token punctuation">:</span> <span class="token parameter">path</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token parameter">r</span> <span class="token operator">=&gt;</span> require<span class="token punctuation">.</span><span class="token function">ensure</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span>
      <span class="token function">r</span><span class="token punctuation">(</span><span class="token function">require</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">./docs/zh-CN</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>path<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">.md</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token string">&apos;zh-CN&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token string">&apos;en-US&apos;</span><span class="token punctuation">:</span> <span class="token parameter">path</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token parameter">r</span> <span class="token operator">=&gt;</span> require<span class="token punctuation">.</span><span class="token function">ensure</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span>
      <span class="token function">r</span><span class="token punctuation">(</span><span class="token function">require</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">./docs/en-US</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>path<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">.md</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token string">&apos;en-US&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token string">&apos;es&apos;</span><span class="token punctuation">:</span> <span class="token parameter">path</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token parameter">r</span> <span class="token operator">=&gt;</span> require<span class="token punctuation">.</span><span class="token function">ensure</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span>
      <span class="token function">r</span><span class="token punctuation">(</span><span class="token function">require</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">./docs/es</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>path<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">.md</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token string">&apos;es&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token string">&apos;fr-FR&apos;</span><span class="token punctuation">:</span> <span class="token parameter">path</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token parameter">r</span> <span class="token operator">=&gt;</span> require<span class="token punctuation">.</span><span class="token function">ensure</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span>
      <span class="token function">r</span><span class="token punctuation">(</span><span class="token function">require</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">./docs/fr-FR</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>path<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">.md</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token string">&apos;fr-FR&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>

<span class="token keyword">const</span> <span class="token function-variable function">loadDocs</span> <span class="token operator">=</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token parameter">lang<span class="token punctuation">,</span> path</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">return</span> <span class="token constant">LOAD_DOCS_MAP</span><span class="token punctuation">[</span>lang<span class="token punctuation">]</span><span class="token punctuation">(</span>path<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>

<span class="token keyword">const</span> <span class="token function-variable function">registerRoute</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">navConfig</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
  <span class="token keyword">let</span> route <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
  Object<span class="token punctuation">.</span><span class="token function">keys</span><span class="token punctuation">(</span>navConfig<span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">forEach</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">lang<span class="token punctuation">,</span> index</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
    <span class="token keyword">let</span> navs <span class="token operator">=</span> navConfig<span class="token punctuation">[</span>lang<span class="token punctuation">]</span><span class="token punctuation">;</span>
    route<span class="token punctuation">.</span><span class="token function">push</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
      path<span class="token punctuation">:</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span> lang <span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">/component</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">,</span>
      redirect<span class="token punctuation">:</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span> lang <span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">/component/installation</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">,</span>
      component<span class="token punctuation">:</span> <span class="token function">load</span><span class="token punctuation">(</span>lang<span class="token punctuation">,</span> <span class="token string">&apos;component&apos;</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
      children<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span>
    <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    navs<span class="token punctuation">.</span><span class="token function">forEach</span><span class="token punctuation">(</span><span class="token parameter">nav</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
      <span class="token keyword">if</span> <span class="token punctuation">(</span>nav<span class="token punctuation">.</span>href<span class="token punctuation">)</span> <span class="token keyword">return</span><span class="token punctuation">;</span>
      <span class="token keyword">if</span> <span class="token punctuation">(</span>nav<span class="token punctuation">.</span>groups<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        nav<span class="token punctuation">.</span>groups<span class="token punctuation">.</span><span class="token function">forEach</span><span class="token punctuation">(</span><span class="token parameter">group</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
          group<span class="token punctuation">.</span>list<span class="token punctuation">.</span><span class="token function">forEach</span><span class="token punctuation">(</span><span class="token parameter">nav</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
            <span class="token function">addRoute</span><span class="token punctuation">(</span>nav<span class="token punctuation">,</span> lang<span class="token punctuation">,</span> index<span class="token punctuation">)</span><span class="token punctuation">;</span>
          <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token keyword">if</span> <span class="token punctuation">(</span>nav<span class="token punctuation">.</span>children<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        nav<span class="token punctuation">.</span>children<span class="token punctuation">.</span><span class="token function">forEach</span><span class="token punctuation">(</span><span class="token parameter">nav</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
          <span class="token function">addRoute</span><span class="token punctuation">(</span>nav<span class="token punctuation">,</span> lang<span class="token punctuation">,</span> index<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token punctuation">{</span>
        <span class="token function">addRoute</span><span class="token punctuation">(</span>nav<span class="token punctuation">,</span> lang<span class="token punctuation">,</span> index<span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token punctuation">}</span>
    <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token keyword">function</span> <span class="token function">addRoute</span><span class="token punctuation">(</span><span class="token parameter">page<span class="token punctuation">,</span> lang<span class="token punctuation">,</span> index</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">const</span> component <span class="token operator">=</span> page<span class="token punctuation">.</span>path <span class="token operator">===</span> <span class="token string">&apos;/changelog&apos;</span>
      <span class="token operator">?</span> <span class="token function">load</span><span class="token punctuation">(</span>lang<span class="token punctuation">,</span> <span class="token string">&apos;changelog&apos;</span><span class="token punctuation">)</span>
      <span class="token punctuation">:</span> <span class="token function">loadDocs</span><span class="token punctuation">(</span>lang<span class="token punctuation">,</span> page<span class="token punctuation">.</span>path<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">let</span> child <span class="token operator">=</span> <span class="token punctuation">{</span>
      path<span class="token punctuation">:</span> page<span class="token punctuation">.</span>path<span class="token punctuation">.</span><span class="token function">slice</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
      meta<span class="token punctuation">:</span> <span class="token punctuation">{</span>
        title<span class="token punctuation">:</span> page<span class="token punctuation">.</span>title <span class="token operator">||</span> page<span class="token punctuation">.</span>name<span class="token punctuation">,</span>
        description<span class="token punctuation">:</span> page<span class="token punctuation">.</span>description<span class="token punctuation">,</span>
        lang
      <span class="token punctuation">}</span><span class="token punctuation">,</span>
      name<span class="token punctuation">:</span> <span class="token string">&apos;component-&apos;</span> <span class="token operator">+</span> lang <span class="token operator">+</span> <span class="token punctuation">(</span>page<span class="token punctuation">.</span>title <span class="token operator">||</span> page<span class="token punctuation">.</span>name<span class="token punctuation">)</span><span class="token punctuation">,</span>
      component<span class="token punctuation">:</span> component<span class="token punctuation">.</span>default <span class="token operator">||</span> component
    <span class="token punctuation">}</span><span class="token punctuation">;</span>

    route<span class="token punctuation">[</span>index<span class="token punctuation">]</span><span class="token punctuation">.</span>children<span class="token punctuation">.</span><span class="token function">push</span><span class="token punctuation">(</span>child<span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>

  <span class="token keyword">return</span> route<span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>

<span class="token keyword">let</span> route <span class="token operator">=</span> <span class="token function">registerRoute</span><span class="token punctuation">(</span>navConfig<span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token keyword">const</span> <span class="token function-variable function">generateMiscRoutes</span> <span class="token operator">=</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token parameter">lang</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">let</span> guideRoute <span class="token operator">=</span> <span class="token punctuation">{</span>
    path<span class="token punctuation">:</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span> lang <span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">/guide</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">,</span> <span class="token comment">// &#x6307;&#x5357;</span>
    redirect<span class="token punctuation">:</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span> lang <span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">/guide/design</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">,</span>
    component<span class="token punctuation">:</span> <span class="token function">load</span><span class="token punctuation">(</span>lang<span class="token punctuation">,</span> <span class="token string">&apos;guide&apos;</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    children<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>
      path<span class="token punctuation">:</span> <span class="token string">&apos;design&apos;</span><span class="token punctuation">,</span> <span class="token comment">// &#x8BBE;&#x8BA1;&#x539F;&#x5219;</span>
      name<span class="token punctuation">:</span> <span class="token string">&apos;guide-design&apos;</span> <span class="token operator">+</span> lang<span class="token punctuation">,</span>
      meta<span class="token punctuation">:</span> <span class="token punctuation">{</span> lang <span class="token punctuation">}</span><span class="token punctuation">,</span>
      component<span class="token punctuation">:</span> <span class="token function">load</span><span class="token punctuation">(</span>lang<span class="token punctuation">,</span> <span class="token string">&apos;design&apos;</span><span class="token punctuation">)</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>
      path<span class="token punctuation">:</span> <span class="token string">&apos;nav&apos;</span><span class="token punctuation">,</span> <span class="token comment">// &#x5BFC;&#x822A;</span>
      name<span class="token punctuation">:</span> <span class="token string">&apos;guide-nav&apos;</span> <span class="token operator">+</span> lang<span class="token punctuation">,</span>
      meta<span class="token punctuation">:</span> <span class="token punctuation">{</span> lang <span class="token punctuation">}</span><span class="token punctuation">,</span>
      component<span class="token punctuation">:</span> <span class="token function">load</span><span class="token punctuation">(</span>lang<span class="token punctuation">,</span> <span class="token string">&apos;nav&apos;</span><span class="token punctuation">)</span>
    <span class="token punctuation">}</span><span class="token punctuation">]</span>
  <span class="token punctuation">}</span><span class="token punctuation">;</span>

  <span class="token keyword">let</span> themeRoute <span class="token operator">=</span> <span class="token punctuation">{</span>
    path<span class="token punctuation">:</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span> lang <span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">/theme</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">,</span>
    component<span class="token punctuation">:</span> <span class="token function">load</span><span class="token punctuation">(</span>lang<span class="token punctuation">,</span> <span class="token string">&apos;theme-nav&apos;</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    children<span class="token punctuation">:</span> <span class="token punctuation">[</span>
      <span class="token punctuation">{</span>
        path<span class="token punctuation">:</span> <span class="token string">&apos;/&apos;</span><span class="token punctuation">,</span> <span class="token comment">// &#x4E3B;&#x9898;&#x7BA1;&#x7406;</span>
        name<span class="token punctuation">:</span> <span class="token string">&apos;theme&apos;</span> <span class="token operator">+</span> lang<span class="token punctuation">,</span>
        meta<span class="token punctuation">:</span> <span class="token punctuation">{</span> lang <span class="token punctuation">}</span><span class="token punctuation">,</span>
        component<span class="token punctuation">:</span> <span class="token function">load</span><span class="token punctuation">(</span>lang<span class="token punctuation">,</span> <span class="token string">&apos;theme&apos;</span><span class="token punctuation">)</span>
      <span class="token punctuation">}</span><span class="token punctuation">,</span>
      <span class="token punctuation">{</span>
        path<span class="token punctuation">:</span> <span class="token string">&apos;preview&apos;</span><span class="token punctuation">,</span> <span class="token comment">// &#x4E3B;&#x9898;&#x9884;&#x89C8;&#x7F16;&#x8F91;</span>
        name<span class="token punctuation">:</span> <span class="token string">&apos;theme-preview-&apos;</span> <span class="token operator">+</span> lang<span class="token punctuation">,</span>
        meta<span class="token punctuation">:</span> <span class="token punctuation">{</span> lang <span class="token punctuation">}</span><span class="token punctuation">,</span>
        component<span class="token punctuation">:</span> <span class="token function">load</span><span class="token punctuation">(</span>lang<span class="token punctuation">,</span> <span class="token string">&apos;theme-preview&apos;</span><span class="token punctuation">)</span>
      <span class="token punctuation">}</span><span class="token punctuation">]</span>
  <span class="token punctuation">}</span><span class="token punctuation">;</span>

  <span class="token keyword">let</span> resourceRoute <span class="token operator">=</span> <span class="token punctuation">{</span>
    path<span class="token punctuation">:</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span> lang <span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">/resource</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">,</span> <span class="token comment">// &#x8D44;&#x6E90;</span>
    meta<span class="token punctuation">:</span> <span class="token punctuation">{</span> lang <span class="token punctuation">}</span><span class="token punctuation">,</span>
    name<span class="token punctuation">:</span> <span class="token string">&apos;resource&apos;</span> <span class="token operator">+</span> lang<span class="token punctuation">,</span>
    component<span class="token punctuation">:</span> <span class="token function">load</span><span class="token punctuation">(</span>lang<span class="token punctuation">,</span> <span class="token string">&apos;resource&apos;</span><span class="token punctuation">)</span>
  <span class="token punctuation">}</span><span class="token punctuation">;</span>

  <span class="token keyword">let</span> indexRoute <span class="token operator">=</span> <span class="token punctuation">{</span>
    path<span class="token punctuation">:</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span> lang <span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">,</span> <span class="token comment">// &#x9996;&#x9875;</span>
    meta<span class="token punctuation">:</span> <span class="token punctuation">{</span> lang <span class="token punctuation">}</span><span class="token punctuation">,</span>
    name<span class="token punctuation">:</span> <span class="token string">&apos;home&apos;</span> <span class="token operator">+</span> lang<span class="token punctuation">,</span>
    component<span class="token punctuation">:</span> <span class="token function">load</span><span class="token punctuation">(</span>lang<span class="token punctuation">,</span> <span class="token string">&apos;index&apos;</span><span class="token punctuation">)</span>
  <span class="token punctuation">}</span><span class="token punctuation">;</span>

  <span class="token keyword">return</span> <span class="token punctuation">[</span>guideRoute<span class="token punctuation">,</span> resourceRoute<span class="token punctuation">,</span> themeRoute<span class="token punctuation">,</span> indexRoute<span class="token punctuation">]</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>

langs<span class="token punctuation">.</span><span class="token function">forEach</span><span class="token punctuation">(</span><span class="token parameter">lang</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
  route <span class="token operator">=</span> route<span class="token punctuation">.</span><span class="token function">concat</span><span class="token punctuation">(</span><span class="token function">generateMiscRoutes</span><span class="token punctuation">(</span>lang<span class="token punctuation">.</span>lang<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

route<span class="token punctuation">.</span><span class="token function">push</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
  path<span class="token punctuation">:</span> <span class="token string">&apos;/play&apos;</span><span class="token punctuation">,</span>
  name<span class="token punctuation">:</span> <span class="token string">&apos;play&apos;</span><span class="token punctuation">,</span>
  component<span class="token punctuation">:</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;./play/index.vue&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token keyword">let</span> userLanguage <span class="token operator">=</span> localStorage<span class="token punctuation">.</span><span class="token function">getItem</span><span class="token punctuation">(</span><span class="token string">&apos;ELEMENT_LANGUAGE&apos;</span><span class="token punctuation">)</span> <span class="token operator">||</span> window<span class="token punctuation">.</span>navigator<span class="token punctuation">.</span>language <span class="token operator">||</span> <span class="token string">&apos;en-US&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">let</span> defaultPath <span class="token operator">=</span> <span class="token string">&apos;/en-US&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">if</span> <span class="token punctuation">(</span>userLanguage<span class="token punctuation">.</span><span class="token function">indexOf</span><span class="token punctuation">(</span><span class="token string">&apos;zh-&apos;</span><span class="token punctuation">)</span> <span class="token operator">!==</span> <span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  defaultPath <span class="token operator">=</span> <span class="token string">&apos;/zh-CN&apos;</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token keyword">if</span> <span class="token punctuation">(</span>userLanguage<span class="token punctuation">.</span><span class="token function">indexOf</span><span class="token punctuation">(</span><span class="token string">&apos;es&apos;</span><span class="token punctuation">)</span> <span class="token operator">!==</span> <span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  defaultPath <span class="token operator">=</span> <span class="token string">&apos;/es&apos;</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token keyword">if</span> <span class="token punctuation">(</span>userLanguage<span class="token punctuation">.</span><span class="token function">indexOf</span><span class="token punctuation">(</span><span class="token string">&apos;fr&apos;</span><span class="token punctuation">)</span> <span class="token operator">!==</span> <span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  defaultPath <span class="token operator">=</span> <span class="token string">&apos;/fr-FR&apos;</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>

route <span class="token operator">=</span> route<span class="token punctuation">.</span><span class="token function">concat</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">{</span>
  path<span class="token punctuation">:</span> <span class="token string">&apos;/&apos;</span><span class="token punctuation">,</span>
  redirect<span class="token punctuation">:</span> defaultPath
<span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>
  path<span class="token punctuation">:</span> <span class="token string">&apos;*&apos;</span><span class="token punctuation">,</span>
  redirect<span class="token punctuation">:</span> defaultPath
<span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token keyword">export</span> <span class="token keyword">default</span> route<span class="token punctuation">;</span>
</code></pre>
<p>&#x8FD9;&#x4E2A;&#x8DEF;&#x7531;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x63D0;&#x4F9B;&#x4E86;&#x6307;&#x5357;&#x3001;&#x7EC4;&#x4EF6;&#x3001;&#x4E3B;&#x9898;&#x3001;&#x8D44;&#x6E90;&#x7B49;&#x591A;&#x4E2A;&#x8DEF;&#x7531;&#x9875;&#x9762;&#x7684;&#x914D;&#x7F6E;&#xFF0C;&#x5E76;&#x4E14;&#x652F;&#x6301;&#x4E86;&#x591A;&#x8BED;&#x8A00;&#xFF0C;&#x6211;&#x4EEC;&#x91CD;&#x70B9;&#x5173;&#x6CE8;&#x4E00;&#x4E0B;&#x7EC4;&#x4EF6;&#x8DEF;&#x7531;&#x662F;&#x5982;&#x4F55;&#x751F;&#x6210;&#x7684;&#xFF0C;&#x5B83;&#x4E3B;&#x8981;&#x901A;&#x8FC7; registerRoute(navConfig) &#x65B9;&#x6CD5;&#x751F;&#x6210;&#x3002;</p>
<p>&#x5176;&#x4E2D; navConfig &#x8BFB;&#x53D6;&#x7684;&#x662F; examples/nav.config.json &#x6587;&#x4EF6;&#xFF0C;&#x8FD9;&#x4E2A;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x592A;&#x957F;&#x6211;&#x5C31;&#x4E0D;&#x8D34;&#x4E86;&#xFF0C;&#x5B83;&#x5305;&#x62EC;&#x4E86;&#x591A;&#x4E2A;&#x8BED;&#x8A00;&#x7684;&#x914D;&#x7F6E;&#xFF0C;&#x7EF4;&#x62A4;&#x4E86;&#x5DE6;&#x4FA7;&#x7EC4;&#x4EF6;&#x5BFC;&#x822A;&#x83DC;&#x5355;&#x8DEF;&#x5F84;&#x6620;&#x5C04;&#x5173;&#x7CFB;&#x3002;</p>
<p>registerRoute &#x51FD;&#x6570;&#x5185;&#x90E8;&#x5C31;&#x662F;&#x904D;&#x5386; navConfig&#xFF0C;&#x6839;&#x636E;&#x5B83;&#x5185;&#x90E8;&#x5143;&#x7D20;&#x7684;&#x6570;&#x636E;&#x7ED3;&#x6784;&#x751F;&#x6210;&#x8DEF;&#x7531;&#x914D;&#x7F6E;&#xFF0C;&#x5982;&#x679C;&#x6570;&#x636E;&#x4E2D;&#x6709; children &#x5219;&#x751F;&#x6210;&#x5B50;&#x8DEF;&#x7531;&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x77E5;&#x9053; Vue Router &#x7684;&#x672C;&#x8D28;&#x662F;&#x6839;&#x636E;&#x4E0D;&#x540C;&#x7684; URL path&#xFF0C;router-view &#x7EC4;&#x4EF6;&#x6620;&#x5C04;&#x5230;&#x5BF9;&#x5E94;&#x7684;&#x8DEF;&#x7531;&#x7EC4;&#x4EF6;&#xFF0C;&#x5BF9;&#x4E8E;&#x6BCF;&#x4E00;&#x4E2A;&#x7EC4;&#x4EF6;&#x7684;&#x8DEF;&#x7531;&#xFF0C;&#x90FD;&#x662F;&#x901A;&#x8FC7; addRoute(nav, lang, index) &#x65B9;&#x6CD5;&#x751F;&#x6210;&#x7684;&#xFF0C;&#x8BE5;&#x65B9;&#x6CD5;&#x5185;&#x90E8;&#x53C8;&#x8C03;&#x7528;&#x4E86; loadDocs(lang, page.path) &#x83B7;&#x53D6;&#x5230;&#x5BF9;&#x5E94;&#x7684;&#x8DEF;&#x7531;&#x7EC4;&#x4EF6;&#x3002;</p>
<pre class="language-"><code class="lang-javascript"><span class="token keyword">const</span> <span class="token function-variable function">loadDocs</span> <span class="token operator">=</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token parameter">lang<span class="token punctuation">,</span> path</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">return</span> <span class="token constant">LOAD_DOCS_MAP</span><span class="token punctuation">[</span>lang<span class="token punctuation">]</span><span class="token punctuation">(</span>path<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>

<span class="token keyword">const</span> <span class="token constant">LOAD_DOCS_MAP</span> <span class="token operator">=</span> <span class="token punctuation">{</span>
  <span class="token string">&apos;zh-CN&apos;</span><span class="token punctuation">:</span> <span class="token parameter">path</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token parameter">r</span> <span class="token operator">=&gt;</span> require<span class="token punctuation">.</span><span class="token function">ensure</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span>
      <span class="token function">r</span><span class="token punctuation">(</span><span class="token function">require</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">./docs/zh-CN</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>path<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">.md</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token string">&apos;zh-CN&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token string">&apos;en-US&apos;</span><span class="token punctuation">:</span> <span class="token parameter">path</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token parameter">r</span> <span class="token operator">=&gt;</span> require<span class="token punctuation">.</span><span class="token function">ensure</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span>
      <span class="token function">r</span><span class="token punctuation">(</span><span class="token function">require</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">./docs/en-US</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>path<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">.md</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token string">&apos;en-US&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token string">&apos;es&apos;</span><span class="token punctuation">:</span> <span class="token parameter">path</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token parameter">r</span> <span class="token operator">=&gt;</span> require<span class="token punctuation">.</span><span class="token function">ensure</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span>
      <span class="token function">r</span><span class="token punctuation">(</span><span class="token function">require</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">./docs/es</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>path<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">.md</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token string">&apos;es&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token string">&apos;fr-FR&apos;</span><span class="token punctuation">:</span> <span class="token parameter">path</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token parameter">r</span> <span class="token operator">=&gt;</span> require<span class="token punctuation">.</span><span class="token function">ensure</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span>
      <span class="token function">r</span><span class="token punctuation">(</span><span class="token function">require</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">./docs/fr-FR</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>path<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">.md</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token string">&apos;fr-FR&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<p>&#x4EE5;&#x4E2D;&#x6587;&#x4E3A;&#x4F8B;&#xFF0C;&#x6211;&#x4EEC;&#x83B7;&#x53D6;&#x5230;&#x67D0;&#x4E2A; path &#x4E0B;&#x7684;&#x8DEF;&#x7531;&#x7EC4;&#x4EF6;&#x5C31;&#x662F;&#x4E00;&#x4E2A;&#x5DE5;&#x5382;&#x51FD;&#x6570;&#xFF0C;&#x5B83;&#x5BF9;&#x5E94;&#x52A0;&#x8F7D;&#x7684;&#x7EC4;&#x4EF6;&#x8DEF;&#x5F84;&#x662F; exmaples/docs/zh-CN/${path}.md&#x3002;&#x8FD9;&#x91CC;&#x8981;&#x6CE8;&#x610F;&#x7684;&#x662F;&#xFF0C;&#x548C;&#x6211;&#x4EEC;&#x666E;&#x901A;&#x7684;&#x5F02;&#x6B65;&#x7EC4;&#x4EF6;&#x52A0;&#x8F7D;&#x65B9;&#x5F0F;&#x4E0D;&#x540C;&#xFF0C;&#x8FD9;&#x91CC;&#x52A0;&#x8F7D;&#x7684;&#x5C45;&#x7136;&#x662F;&#x4E00;&#x4E2A; .md &#x6587;&#x4EF6;&#xFF0C;&#x800C;&#x5E76;&#x975E;&#x4E00;&#x4E2A; .vue &#x6587;&#x4EF6;&#xFF0C;&#x4F46;&#x5374;&#x80FD;&#x548C; .vue &#x6587;&#x4EF6;&#x4E00;&#x6837;&#x80FD;&#x6E32;&#x67D3;&#x6210;&#x4E00;&#x4E2A; Vue &#x7EC4;&#x4EF6;&#xFF0C;&#x8FD9;&#x662F;&#x5982;&#x4F55;&#x505A;&#x5230;&#x7684;&#x5462;&#xFF1F;</p>
<p>&#x6211;&#x4EEC;&#x77E5;&#x9053;&#xFF0C;webpack &#x7684;&#x7406;&#x5FF5;&#x662F;&#x4E00;&#x5207;&#x8D44;&#x6E90;&#x90FD;&#x53EF;&#x4EE5; require&#xFF0C;&#x53EA;&#x8981;&#x914D;&#x7F6E;&#x4E86;&#x5BF9;&#x5E94;&#x7684; loader&#x3002;&#x56DE;&#x5230; build/webpack.demo.js&#xFF0C;&#x6211;&#x4EEC;&#x53D1;&#x73B0;&#x5BF9;&#x4E8E; .md &#x6587;&#x4EF6;&#x6211;&#x4EEC;&#x914D;&#x7F6E;&#x4E86;&#x76F8;&#x5E94;&#x7684; loader&#xFF1A;</p>
<pre class="language-"><code class="lang-javascript"> <span class="token punctuation">{</span>
    test<span class="token punctuation">:</span> <span class="token regex">/\.md$/</span><span class="token punctuation">,</span>
    use<span class="token punctuation">:</span> <span class="token punctuation">[</span>
      <span class="token punctuation">{</span>
        loader<span class="token punctuation">:</span> <span class="token string">&apos;vue-loader&apos;</span><span class="token punctuation">,</span>
        options<span class="token punctuation">:</span> <span class="token punctuation">{</span>
          compilerOptions<span class="token punctuation">:</span> <span class="token punctuation">{</span>
            preserveWhitespace<span class="token punctuation">:</span> <span class="token boolean">false</span>
          <span class="token punctuation">}</span>
        <span class="token punctuation">}</span>
      <span class="token punctuation">}</span><span class="token punctuation">,</span>
      <span class="token punctuation">{</span>
        loader<span class="token punctuation">:</span> path<span class="token punctuation">.</span><span class="token function">resolve</span><span class="token punctuation">(</span>__dirname<span class="token punctuation">,</span> <span class="token string">&apos;./md-loader/index.js&apos;</span><span class="token punctuation">)</span>
      <span class="token punctuation">}</span>
    <span class="token punctuation">]</span>
  <span class="token punctuation">}</span>
</code></pre>
<p>&#x5BF9;&#x4E8E; .md &#x6587;&#x4EF6;&#xFF0C;&#x8FD9;&#x91CC; use &#x6570;&#x7EC4;&#x4E2D;&#x914D;&#x7F6E;&#x4E86; 2 &#x9879;&#xFF0C;&#x5B83;&#x4EEC;&#x6267;&#x884C;&#x987A;&#x5E8F;&#x662F;&#x9006;&#x5E8F;&#x7684;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x5148;&#x6267;&#x884C; md-loader&#xFF0C;&#x518D;&#x6267;&#x884C; vue-loader&#xFF0C;md-loader &#x7684;&#x4EE3;&#x7801;&#x5728; build/md-loader/index.js &#x4E2D;&#xFF1A;</p>
<pre class="language-"><code class="lang-javascript"><span class="token keyword">const</span> <span class="token punctuation">{</span>
  stripScript<span class="token punctuation">,</span>
  stripTemplate<span class="token punctuation">,</span>
  genInlineComponentText
<span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;./util&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> md <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;./config&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

module<span class="token punctuation">.</span><span class="token function-variable function">exports</span> <span class="token operator">=</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token parameter">source</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">const</span> content <span class="token operator">=</span> md<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span>source<span class="token punctuation">)</span><span class="token punctuation">;</span>

  <span class="token keyword">const</span> startTag <span class="token operator">=</span> <span class="token string">&apos;&lt;!--element-demo:&apos;</span><span class="token punctuation">;</span>
  <span class="token keyword">const</span> startTagLen <span class="token operator">=</span> startTag<span class="token punctuation">.</span>length<span class="token punctuation">;</span>
  <span class="token keyword">const</span> endTag <span class="token operator">=</span> <span class="token string">&apos;:element-demo--&gt;&apos;</span><span class="token punctuation">;</span>
  <span class="token keyword">const</span> endTagLen <span class="token operator">=</span> endTag<span class="token punctuation">.</span>length<span class="token punctuation">;</span>

  <span class="token keyword">let</span> componenetsString <span class="token operator">=</span> <span class="token string">&apos;&apos;</span><span class="token punctuation">;</span>
  <span class="token keyword">let</span> id <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> <span class="token comment">// demo &#x7684; id</span>
  <span class="token keyword">let</span> output <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">;</span> <span class="token comment">// &#x8F93;&#x51FA;&#x7684;&#x5185;&#x5BB9;</span>
  <span class="token keyword">let</span> start <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> <span class="token comment">// &#x5B57;&#x7B26;&#x4E32;&#x5F00;&#x59CB;&#x4F4D;&#x7F6E;</span>

  <span class="token keyword">let</span> commentStart <span class="token operator">=</span> content<span class="token punctuation">.</span><span class="token function">indexOf</span><span class="token punctuation">(</span>startTag<span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token keyword">let</span> commentEnd <span class="token operator">=</span> content<span class="token punctuation">.</span><span class="token function">indexOf</span><span class="token punctuation">(</span>endTag<span class="token punctuation">,</span> commentStart <span class="token operator">+</span> startTagLen<span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token keyword">while</span> <span class="token punctuation">(</span>commentStart <span class="token operator">!==</span> <span class="token operator">-</span><span class="token number">1</span> <span class="token operator">&amp;&amp;</span> commentEnd <span class="token operator">!==</span> <span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    output<span class="token punctuation">.</span><span class="token function">push</span><span class="token punctuation">(</span>content<span class="token punctuation">.</span><span class="token function">slice</span><span class="token punctuation">(</span>start<span class="token punctuation">,</span> commentStart<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token keyword">const</span> commentContent <span class="token operator">=</span> content<span class="token punctuation">.</span><span class="token function">slice</span><span class="token punctuation">(</span>commentStart <span class="token operator">+</span> startTagLen<span class="token punctuation">,</span> commentEnd<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">const</span> html <span class="token operator">=</span> <span class="token function">stripTemplate</span><span class="token punctuation">(</span>commentContent<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">const</span> script <span class="token operator">=</span> <span class="token function">stripScript</span><span class="token punctuation">(</span>commentContent<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">let</span> demoComponentContent <span class="token operator">=</span> <span class="token function">genInlineComponentText</span><span class="token punctuation">(</span>html<span class="token punctuation">,</span> script<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">const</span> demoComponentName <span class="token operator">=</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">element-demo</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>id<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">;</span>
    output<span class="token punctuation">.</span><span class="token function">push</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">&lt;template slot=&quot;source&quot;&gt;&lt;</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>demoComponentName<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string"> /&gt;&lt;/template&gt;</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    componenetsString <span class="token operator">+=</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span><span class="token constant">JSON</span><span class="token punctuation">.</span><span class="token function">stringify</span><span class="token punctuation">(</span>demoComponentName<span class="token punctuation">)</span><span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">: </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>demoComponentContent<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">,</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">;</span>

    <span class="token comment">// &#x91CD;&#x65B0;&#x8BA1;&#x7B97;&#x4E0B;&#x4E00;&#x6B21;&#x7684;&#x4F4D;&#x7F6E;</span>
    id<span class="token operator">++</span><span class="token punctuation">;</span>
    start <span class="token operator">=</span> commentEnd <span class="token operator">+</span> endTagLen<span class="token punctuation">;</span>
    commentStart <span class="token operator">=</span> content<span class="token punctuation">.</span><span class="token function">indexOf</span><span class="token punctuation">(</span>startTag<span class="token punctuation">,</span> start<span class="token punctuation">)</span><span class="token punctuation">;</span>
    commentEnd <span class="token operator">=</span> content<span class="token punctuation">.</span><span class="token function">indexOf</span><span class="token punctuation">(</span>endTag<span class="token punctuation">,</span> commentStart <span class="token operator">+</span> startTagLen<span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>

  <span class="token comment">// &#x4EC5;&#x5141;&#x8BB8;&#x5728; demo &#x4E0D;&#x5B58;&#x5728;&#x65F6;&#xFF0C;&#x624D;&#x53EF;&#x4EE5;&#x5728; Markdown &#x4E2D;&#x5199; script &#x6807;&#x7B7E;</span>
  <span class="token comment">// todo: &#x4F18;&#x5316;&#x8FD9;&#x6BB5;&#x903B;&#x8F91;</span>
  <span class="token keyword">let</span> pageScript <span class="token operator">=</span> <span class="token string">&apos;&apos;</span><span class="token punctuation">;</span>
  <span class="token keyword">if</span> <span class="token punctuation">(</span>componenetsString<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    pageScript <span class="token operator">=</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">&lt;script&gt;
      export default {
        name: &apos;component-doc&apos;,
        components: {
          </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>componenetsString<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">
        }
      }
    &lt;/script&gt;</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token keyword">if</span> <span class="token punctuation">(</span>content<span class="token punctuation">.</span><span class="token function">indexOf</span><span class="token punctuation">(</span><span class="token string">&apos;&lt;script&gt;&apos;</span><span class="token punctuation">)</span> <span class="token operator">===</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token comment">// &#x786C;&#x7F16;&#x7801;&#xFF0C;&#x6709;&#x5F85;&#x6539;&#x5584;</span>
    start <span class="token operator">=</span> content<span class="token punctuation">.</span><span class="token function">indexOf</span><span class="token punctuation">(</span><span class="token string">&apos;&lt;/script&gt;&apos;</span><span class="token punctuation">)</span> <span class="token operator">+</span> <span class="token string">&apos;&lt;/script&gt;&apos;</span><span class="token punctuation">.</span>length<span class="token punctuation">;</span>
    pageScript <span class="token operator">=</span> content<span class="token punctuation">.</span><span class="token function">slice</span><span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span> start<span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>

  output<span class="token punctuation">.</span><span class="token function">push</span><span class="token punctuation">(</span>content<span class="token punctuation">.</span><span class="token function">slice</span><span class="token punctuation">(</span>start<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token keyword">return</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">
    &lt;template&gt;
      &lt;section class=&quot;content element-doc&quot;&gt;
        </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>output<span class="token punctuation">.</span><span class="token function">join</span><span class="token punctuation">(</span><span class="token string">&apos;&apos;</span><span class="token punctuation">)</span><span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">
      &lt;/section&gt;
    &lt;/template&gt;
    </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>pageScript<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">
  </span><span class="token template-punctuation string">`</span></span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<p>webpack loader &#x7684;&#x539F;&#x7406;&#x5F88;&#x7B80;&#x5355;&#xFF0C;&#x8F93;&#x5165;&#x662F;&#x6587;&#x4EF6;&#x7684;&#x539F;&#x59CB;&#x5185;&#x5BB9;&#xFF0C;&#x8FD4;&#x56DE;&#x7684;&#x662F;&#x7ECF;&#x8FC7; loader &#x5904;&#x7406;&#x540E;&#x7684;&#x5185;&#x5BB9;&#x3002;&#x5BF9;&#x4E8E; md-loader&#xFF0C;&#x8F93;&#x5165;&#x7684;&#x662F; .md &#x6587;&#x6863;&#xFF0C;&#x8F93;&#x51FA;&#x7684;&#x5219;&#x662F;&#x4E00;&#x4E2A; Vue SFC &#x683C;&#x5F0F;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x8FD9;&#x6837;&#x5B83;&#x7684;&#x8F93;&#x51FA;&#x5C31;&#x53EF;&#x4EE5;&#x4F5C;&#x4E3A;&#x4E0B;&#x4E00;&#x4E2A; vue-loader &#x7684;&#x8F93;&#x5165;&#x505A;&#x5904;&#x7406;&#x4E86;&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x6765;&#x7B80;&#x5355;&#x770B;&#x4E00;&#x4E0B; md-loader &#x4E2D;&#x95F4;&#x5904;&#x7406;&#x8FC7;&#x7A0B;&#x3002;&#x9996;&#x5148;&#x6267;&#x884C;&#x4E86; md.render(source) &#x5BF9; md &#x6587;&#x6863;&#x89E3;&#x6790;&#xFF0C;&#x63D0;&#x53D6;&#x6587;&#x6863;&#x4E2D; :::demo {content} ::: &#x5185;&#x5BB9;&#xFF0C;&#x5206;&#x522B;&#x751F;&#x6210;&#x4E00;&#x4E9B; Vue &#x7684;&#x6A21;&#x677F;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x7136;&#x540E;&#x518D;&#x4ECE;&#x8FD9;&#x4E2A;&#x6A21;&#x677F;&#x5B57;&#x7B26;&#x4E32;&#x4E2D;&#x5FAA;&#x73AF;&#x67E5;&#x627E; <!--element-demo: 和 :element-demo--> &#x5305;&#x88F9;&#x7684;&#x5185;&#x5BB9;&#xFF0C;&#x4ECE;&#x4E2D;&#x63D0;&#x53D6;&#x6A21;&#x677F;&#x5B57;&#x7B26;&#x4E32;&#x5230; output &#x4E2D;&#xFF0C;&#x63D0;&#x53D6; script &#x5230; componenetsString &#x4E2D;&#xFF0C;&#x7136;&#x540E;&#x6784;&#x9020; pageScript&#xFF0C;&#x6700;&#x540E;&#x8FD4;&#x56DE;&#x7684;&#x5185;&#x5BB9;&#x5C31;&#x662F;&#xFF1A;</p>
<pre class="language-"><code class="lang-javascript"><span class="token keyword">return</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">
    &lt;template&gt;
      &lt;section class=&quot;content element-doc&quot;&gt;
        </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>output<span class="token punctuation">.</span><span class="token function">join</span><span class="token punctuation">(</span><span class="token string">&apos;&apos;</span><span class="token punctuation">)</span><span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">
      &lt;/section&gt;
    &lt;/template&gt;
    </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>pageScript<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">
  </span><span class="token template-punctuation string">`</span></span><span class="token punctuation">;</span>
</code></pre>
<p>&#x6700;&#x7EC8;&#x751F;&#x6210;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#x6EE1;&#x8DB3;&#x6211;&#x4EEC;&#x901A;&#x5E38;&#x7F16;&#x5199;&#x7684; .vue SFC &#x683C;&#x5F0F;&#xFF0C;&#x5B83;&#x4F1A;&#x4F5C;&#x4E3A;&#x4E0B;&#x4E00;&#x4E2A; vue-loader &#x7684;&#x8F93;&#x5165;&#xFF0C;&#x6240;&#x4EE5;&#x8FD9;&#x6837;&#x6211;&#x4EEC;&#x5C31;&#x76F8;&#x5F53;&#x4E8E;&#x901A;&#x8FC7;&#x52A0;&#x8F7D;&#x4E00;&#x4E2A; .md &#x683C;&#x5F0F;&#x7684;&#x6587;&#x4EF6;&#x7684;&#x65B9;&#x5F0F;&#x52A0;&#x8F7D;&#x4E86; Vue &#x7EC4;&#x4EF6;&#x3002;</p>
<p>&#x8FD9;&#x91CC;&#x9762;&#x8FD8;&#x6709;&#x5F88;&#x591A;&#x548C; .md &#x6587;&#x4EF6;&#x89E3;&#x6790;&#x7684;&#x7EC6;&#x8282;&#xFF0C;&#x5982;&#x679C;&#x4F60;&#x5BF9;&#x6700;&#x7EC8;&#x751F;&#x6210;&#x7684; output &#x548C; pageScript &#x4EE3;&#x7801;&#x662F;&#x4EC0;&#x4E48;&#x611F;&#x5174;&#x8DA3;&#xFF0C;&#x5EFA;&#x8BAE;&#x4F60;&#x81EA;&#x5DF1;&#x8C03;&#x8BD5;&#x4E00;&#x756A;&#x3002;</p>
<p>element-ui &#x8FD9;&#x79CD;&#x6587;&#x6863;&#x548C; demo &#x7684;&#x5B9E;&#x73B0;&#x65B9;&#x5F0F;&#x662F;&#x975E;&#x5E38;&#x5DE7;&#x5999;&#x7684;&#xFF0C;&#x5927;&#x5927;&#x51CF;&#x5C11;&#x4E86; demo &#x548C;&#x6587;&#x6863;&#x7684;&#x7EF4;&#x62A4;&#x6210;&#x672C;&#xFF0C;&#x5E76;&#x4E14;&#x5BF9;&#x4E8E;&#x7528;&#x6237;&#x6765;&#x8BF4;&#x4E5F;&#x975E;&#x5E38;&#x53CB;&#x597D;&#xFF0C;&#x5982;&#x679C;&#x4F60;&#x4E5F;&#x4E3A;&#x81EA;&#x5DF1;&#x7684;&#x5E93;&#x6784;&#x5EFA;&#x6587;&#x6863;&#xFF0C;&#x4E0D;&#x59A8;&#x53C2;&#x8003;&#x5B83;&#x7684;&#x5B9E;&#x73B0;&#x3002;</p>
<h2 id="&#x5B89;&#x88C5;--&#x5F15;&#x5165;"><a name="&#x5B89;&#x88C5;--&#x5F15;&#x5165;" class="anchor-navigation-ex-anchor" href="#&#x5B89;&#x88C5;--&#x5F15;&#x5165;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5B89;&#x88C5; &amp; &#x5F15;&#x5165;</h2>
<p>&#x901A;&#x5E38; JS &#x5E93;&#x90FD;&#x4F1A;&#x652F;&#x6301; npm &#x548C; CDN 2 &#x79CD;&#x5B89;&#x88C5;&#x65B9;&#x5F0F;&#xFF0C;element-ui &#x4E5F;&#x4E0D;&#x4F8B;&#x5916;&#x3002;</p>
<p>&#x5148;&#x8BF4;&#x4E00;&#x4E0B; CDN &#x7684;&#x5B89;&#x88C5;&#x65B9;&#x5F0F;&#xFF0C;&#x5B9E;&#x9645;&#x4E0A; element-ui &#x4F1A;&#x628A;&#x6240;&#x6709;&#x7EC4;&#x4EF6;&#x6253;&#x5305;&#x751F;&#x6210;&#x4E00;&#x4EFD; CSS &#x548C; JS&#xFF0C;&#x5B98;&#x65B9;&#x4E5F;&#x63D0;&#x4F9B;&#x4E86;&#x4F8B;&#x5B50;&#xFF1A;</p>
<pre class="language-"><code><span class="token comment">&lt;!-- &#x5F15;&#x5165;&#x6837;&#x5F0F; --&gt;</span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>link</span> <span class="token attr-name">rel</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>stylesheet<span class="token punctuation">&quot;</span></span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>https://unpkg.com/element-ui/lib/theme-chalk/index.css<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
<span class="token comment">&lt;!-- &#x5F15;&#x5165;&#x7EC4;&#x4EF6;&#x5E93; --&gt;</span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>script</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>https://unpkg.com/element-ui/lib/index.js<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span><span class="token script"></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>script</span><span class="token punctuation">&gt;</span></span>
</code></pre><p>CDN &#x5B89;&#x88C5;&#x65B9;&#x5F0F;&#x6709;&#x5B83;&#x7684;&#x597D;&#x5904;&#xFF0C;&#x4E0D;&#x9700;&#x8981;&#x6784;&#x5EFA;&#x5DE5;&#x5177;&#xFF0C;&#x5F00;&#x7BB1;&#x5373;&#x7528;&#xFF0C;&#x4F46;&#x7F3A;&#x70B9;&#x4E5F;&#x5F88;&#x660E;&#x663E;&#xFF0C;&#x5168;&#x91CF;&#x5F15;&#x5165;&#x4E86;&#x6240;&#x6709;&#x7EC4;&#x4EF6;&#xFF0C;&#x4F53;&#x79EF;&#x975E;&#x5E38;&#x5927;&#x3002;</p>
<p>&#x7531;&#x4E8E;&#x5927;&#x90E8;&#x5206;&#x4EBA;&#x5728;&#x5F00;&#x53D1; Vue &#x9879;&#x76EE;&#x90FD;&#x662F;&#x57FA;&#x4E8E; vue-cli &#x811A;&#x624B;&#x67B6;&#x521D;&#x59CB;&#x5316;&#x9879;&#x76EE;&#x7684;&#xFF0C;&#x6240;&#x4EE5;&#x66F4;&#x63A8;&#x8350;&#x4F7F;&#x7528; npm &#x65B9;&#x5F0F;&#x5B89;&#x88C5;&#x3002;</p>
<pre class="language-"><code>npm i element-ui -S
</code></pre><p>&#x8BF4;&#x5230; npm &#x5B89;&#x88C5;&#xFF0C;&#x4E0D;&#x5F97;&#x4E0D;&#x63D0; element-ui &#x63D0;&#x4F9B;&#x7684; 2 &#x79CD;&#x7EC4;&#x4EF6;&#x5F15;&#x5165;&#x65B9;&#x5F0F;&#xFF0C;&#x5B8C;&#x6574;&#x5F15;&#x5165;&#x548C;&#x90E8;&#x5206;&#x5F15;&#x5165;&#x3002;</p>
<p>&#x652F;&#x6301;&#x5B8C;&#x6574;&#x5F15;&#x5165;&#x975E;&#x5E38;&#x5BB9;&#x6613;&#xFF0C;&#x628A;&#x6240;&#x6709;&#x7EC4;&#x4EF6;&#x6253;&#x5305;&#x6210;&#x4E00;&#x4EFD; CSS &#x548C; JS&#xFF0C;&#x5E76;&#x4E14;&#x5728; package.json &#x4E2D;&#x914D;&#x7F6E;&#xFF1A;</p>
<pre class="language-"><code>&quot;main&quot;: &quot;lib/element-ui.common.js&quot;
</code></pre><p>&#x8FD9;&#x6837;&#x5F53;&#x7528;&#x6237;&#x6267;&#x884C; import ElementUI from &apos;element-ui&apos; &#x7684;&#x65F6;&#x5019;&#x5C31;&#x53EF;&#x4EE5;&#x5B8C;&#x6574;&#x5F15;&#x5165;&#x4E86;&#x7EC4;&#x4EF6;&#x7684; JS &#x4EE3;&#x7801;&#x4E86;&#x3002;&#x6B63;&#x5982;&#x6211;&#x4EEC;&#x4E4B;&#x524D;&#x8BF4;&#x7684;&#xFF0C;element-ui &#x4F1A;&#x5355;&#x72EC;&#x53D1;&#x5E03; CSS&#xFF0C;&#x6240;&#x4EE5;&#x4F60;&#x8FD8;&#x9700;&#x8981; import &apos;element-ui/lib/theme-chalk/index.css&apos;&#x3002;</p>
<p>&#x5B8C;&#x6574;&#x5F15;&#x5165;&#x7684;&#x597D;&#x5904;&#x662F;&#x65B9;&#x4FBF;&#xFF0C;&#x53EA;&#x9700;&#x8981; 2 &#x884C;&#x4EE3;&#x7801;&#x5C31;&#x53EF;&#x4EE5;&#x5B8C;&#x6574;&#x5730;&#x4F7F;&#x7528; element-ui &#x6240;&#x6709;&#x7684;&#x7EC4;&#x4EF6;&#xFF0C;&#x4F46;&#x7F3A;&#x70B9;&#x4E5F;&#x5F88;&#x660E;&#x663E;&#xFF0C;&#x5F15;&#x5165;&#x7684;&#x7EC4;&#x4EF6;&#x5305;&#x4F53;&#x79EF;&#x5F88;&#x5927;&#xFF0C;&#x901A;&#x5E38;&#x4E00;&#x4E2A;&#x9879;&#x76EE;&#x4E5F;&#x7528;&#x4E0D;&#x5230;&#x6240;&#x6709;&#x7684;&#x7EC4;&#x4EF6;&#xFF0C;&#x4F1A;&#x6709;&#x8D44;&#x6E90;&#x6D6A;&#x8D39;&#x3002;</p>
<p>&#x56E0;&#x6B64;&#x6700;&#x4F73;&#x5B9E;&#x8DF5;&#x5C31;&#x662F;&#x6309;&#x9700;&#x5F15;&#x5165;&#xFF1A;</p>
<pre class="language-"><code class="lang-javascript"><span class="token keyword">import</span> Vue <span class="token keyword">from</span> <span class="token string">&apos;vue&apos;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> Button <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&apos;element-ui&apos;</span>

Vue<span class="token punctuation">.</span><span class="token function">component</span><span class="token punctuation">(</span>Button<span class="token punctuation">.</span>name<span class="token punctuation">,</span> Button<span class="token punctuation">)</span>
</code></pre>
<p>&#x5927;&#x90E8;&#x5206;&#x4EBA;&#x8FD9;&#x4E48;&#x7528;&#x7684;&#x65F6;&#x5019;&#x4F1A;&#x89C9;&#x5F97;&#x7406;&#x6240;&#x5F53;&#x7136;&#xFF0C;&#x4E0D;&#x77E5;&#x9053;&#x5927;&#x5BB6;&#x6709;&#x6CA1;&#x6709;&#x60F3;&#x8FC7;&#xFF1A;&#x4E3A;&#x4EC0;&#x4E48;&#x8FD9;&#x79CD;&#x5F15;&#x5165;&#x65B9;&#x5F0F;&#x53EF;&#x4EE5;&#x5B9E;&#x73B0;&#x6309;&#x9700;&#x5F15;&#x5165;&#x5462;&#xFF1F;&#x8981;&#x641E;&#x6E05;&#x695A;&#x8FD9;&#x4E2A;&#x95EE;&#x9898;&#xFF0C;&#x5C31;&#x8981;&#x641E;&#x6E05;&#x695A; import { Button } from &apos;element-ui&apos; &#x8FD9;&#x4E2A;&#x80CC;&#x540E;&#x90FD;&#x505A;&#x4E86;&#x4EC0;&#x4E48;&#x3002;</p>
<p>&#x5176;&#x5B9E;&#x5B98;&#x7F51;&#x5DF2;&#x7ECF;&#x6709;&#x7B54;&#x6848;&#x4E86;&#xFF0C;&#x5728;&#x4F7F;&#x7528;&#x6309;&#x9700;&#x5F15;&#x5165;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x8981;&#x501F;&#x52A9; babel-plugin-component &#x8FD9;&#x4E2A; webpack &#x63D2;&#x4EF6;&#xFF0C;&#x5E76;&#x4E14;&#x914D;&#x7F6E; .babelrc&#xFF1A;</p>
<pre class="language-"><code class="lang-javascript"><span class="token punctuation">{</span>
  <span class="token string">&quot;presets&quot;</span><span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token string">&quot;es2015&quot;</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> <span class="token string">&quot;modules&quot;</span><span class="token punctuation">:</span> <span class="token boolean">false</span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
  <span class="token string">&quot;plugins&quot;</span><span class="token punctuation">:</span> <span class="token punctuation">[</span>
    <span class="token punctuation">[</span>
      <span class="token string">&quot;component&quot;</span><span class="token punctuation">,</span>
      <span class="token punctuation">{</span>
        <span class="token string">&quot;libraryName&quot;</span><span class="token punctuation">:</span> <span class="token string">&quot;element-ui&quot;</span><span class="token punctuation">,</span>
        <span class="token string">&quot;styleLibraryName&quot;</span><span class="token punctuation">:</span> <span class="token string">&quot;theme-chalk&quot;</span>
      <span class="token punctuation">}</span>
    <span class="token punctuation">]</span>
  <span class="token punctuation">]</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x5B9E;&#x9645;&#x4E0A;&#x5B83;&#x662F;&#x628A; import { Button } from &apos;element-ui&apos; &#x8F6C;&#x6362;&#x6210;&#xFF1A;</p>
<pre class="language-"><code class="lang-javascript"><span class="token keyword">var</span> button <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;element-ui/lib/button&apos;</span><span class="token punctuation">)</span>
<span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;element-ui/lib/theme-chalk/button.css&apos;</span><span class="token punctuation">)</span>
</code></pre>
<p>&#x8FD9;&#x6837;&#x6211;&#x4EEC;&#x5C31;&#x7CBE;&#x51C6;&#x5730;&#x5F15;&#x5165;&#x4E86;&#x5BF9;&#x5E94; lib &#x4E0B;&#x7684; Button &#x7EC4;&#x4EF6;&#x7684; JS &#x548C; CSS &#x4EE3;&#x7801;&#x4E86;&#xFF0C;&#x4E5F;&#x5C31;&#x5B9E;&#x73B0;&#x4E86;&#x6309;&#x9700;&#x5F15;&#x5165; Button &#x7EC4;&#x4EF6;&#x3002;</p>
<p>element-ui &#x8FD9;&#x79CD;&#x6309;&#x9700;&#x5F15;&#x5165;&#x7684;&#x65B9;&#x5F0F;&#x867D;&#x7136;&#x65B9;&#x4FBF;&#xFF0C;&#x4F46;&#x80CC;&#x540E;&#x5374;&#x8981;&#x89E3;&#x51B3;&#x51E0;&#x4E2A;&#x95EE;&#x9898;&#xFF0C;&#x7531;&#x4E8E;&#x6211;&#x4EEC;&#x652F;&#x6301;&#x6BCF;&#x4E2A;&#x7EC4;&#x4EF6;&#x53EF;&#x4EE5;&#x5355;&#x72EC;&#x5F15;&#x5165;&#xFF0C;&#x90A3;&#x4E48;&#x5982;&#x679C;&#x4EA7;&#x751F;&#x4E86;&#x7EC4;&#x4EF6;&#x4F9D;&#x8D56;&#x5E76;&#x4E14;&#x540C;&#x65F6;&#x6309;&#x9700;&#x5F15;&#x5165;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x4EE3;&#x7801;&#x5197;&#x4F59;&#x95EE;&#x9898;&#x600E;&#x4E48;&#x89E3;&#x51B3;&#x3002;&#x4E3E;&#x4E2A;&#x4F8B;&#x5B50;&#xFF0C;&#x5728; element-ui &#x4E2D;&#xFF0C;Table &#x7EC4;&#x4EF6;&#x4F9D;&#x8D56;&#x4E86; CheckBox &#x7EC4;&#x4EF6;&#xFF0C;&#x90A3;&#x4E48;&#x5F53;&#x6211;&#x540C;&#x65F6;&#x5F15;&#x5165;&#x4E86; Table &#x7EC4;&#x4EF6;&#x548C; CheckBox &#x7EC4;&#x4EF6;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x4F1A;&#x4E0D;&#x4F1A;&#x4EA7;&#x751F;&#x4EE3;&#x7801;&#x5197;&#x4F59;&#x5462;&#xFF1F;</p>
<pre class="language-"><code class="lang-javascript"><span class="token keyword">import</span> <span class="token punctuation">{</span> Table<span class="token punctuation">,</span> CheckBox <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&apos;element-ui&apos;</span>
</code></pre>
<p>&#x5982;&#x679C;&#x4F60;&#x4E0D;&#x505A;&#x4EFB;&#x4F55;&#x5904;&#x7406;&#x7684;&#x8BDD;&#xFF0C;&#x7B54;&#x6848;&#x662F;&#x4F1A;&#xFF0C;&#x4F60;&#x6700;&#x7EC8;&#x5F15;&#x5165;&#x7684;&#x5305;&#x4F1A;&#x6709; 2 &#x4EFD; CheckBox &#x7684;&#x4EE3;&#x7801;&#x3002;&#x90A3;&#x4E48; element-ui &#x662F;&#x600E;&#x4E48;&#x89E3;&#x51B3;&#x8FD9;&#x4E2A;&#x95EE;&#x9898;&#x7684;&#x5462;&#xFF1F;&#x5B9E;&#x9645;&#x4E0A;&#x53EA;&#x662F;&#x90E8;&#x5206;&#x89E3;&#x51B3;&#x4E86;&#xFF0C;&#x5B83;&#x7684; webpack &#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x4E2D;&#x914D;&#x7F6E;&#x4E86; externals&#xFF0C;&#x5728; build/config.js &#x4E2D;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x8FD9;&#x4E9B;&#x5177;&#x4F53;&#x7684;&#x914D;&#x7F6E;&#xFF1A;</p>
<pre class="language-"><code class="lang-javascript"><span class="token keyword">var</span> externals <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span>

Object<span class="token punctuation">.</span><span class="token function">keys</span><span class="token punctuation">(</span>Components<span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">forEach</span><span class="token punctuation">(</span><span class="token keyword">function</span><span class="token punctuation">(</span><span class="token parameter">key</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  externals<span class="token punctuation">[</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">element-ui/packages/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>key<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">element-ui/lib/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>key<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

externals<span class="token punctuation">[</span><span class="token string">&apos;element-ui/src/locale&apos;</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token string">&apos;element-ui/lib/locale&apos;</span><span class="token punctuation">;</span>
utilsList<span class="token punctuation">.</span><span class="token function">forEach</span><span class="token punctuation">(</span><span class="token keyword">function</span><span class="token punctuation">(</span><span class="token parameter">file</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  file <span class="token operator">=</span> path<span class="token punctuation">.</span><span class="token function">basename</span><span class="token punctuation">(</span>file<span class="token punctuation">,</span> <span class="token string">&apos;.js&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  externals<span class="token punctuation">[</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">element-ui/src/utils/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>file<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">element-ui/lib/utils/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>file<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
mixinsList<span class="token punctuation">.</span><span class="token function">forEach</span><span class="token punctuation">(</span><span class="token keyword">function</span><span class="token punctuation">(</span><span class="token parameter">file</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  file <span class="token operator">=</span> path<span class="token punctuation">.</span><span class="token function">basename</span><span class="token punctuation">(</span>file<span class="token punctuation">,</span> <span class="token string">&apos;.js&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  externals<span class="token punctuation">[</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">element-ui/src/mixins/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>file<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">element-ui/lib/mixins/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>file<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
transitionList<span class="token punctuation">.</span><span class="token function">forEach</span><span class="token punctuation">(</span><span class="token keyword">function</span><span class="token punctuation">(</span><span class="token parameter">file</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  file <span class="token operator">=</span> path<span class="token punctuation">.</span><span class="token function">basename</span><span class="token punctuation">(</span>file<span class="token punctuation">,</span> <span class="token string">&apos;.js&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  externals<span class="token punctuation">[</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">element-ui/src/transitions/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>file<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">element-ui/lib/transitions/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>file<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

externals <span class="token operator">=</span> <span class="token punctuation">[</span>Object<span class="token punctuation">.</span><span class="token function">assign</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
  vue<span class="token punctuation">:</span> <span class="token string">&apos;vue&apos;</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span> externals<span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">nodeExternals</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
</code></pre>
<p>externals &#x53EF;&#x4EE5;&#x9632;&#x6B62;&#x5C06;&#x8FD9;&#x4E9B; import &#x7684;&#x5305;&#x6253;&#x5305;&#x5230; bundle &#x4E2D;&#xFF0C;&#x5E76;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x518D;&#x53BB;&#x4ECE;&#x5916;&#x90E8;&#x83B7;&#x53D6;&#x8FD9;&#x4E9B;&#x6269;&#x5C55;&#x4F9D;&#x8D56;&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x6765;&#x770B;&#x4E00;&#x4E0B;&#x6253;&#x5305;&#x540E;&#x7684; lib/table.js&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x7F16;&#x8BD1;&#x540E;&#x7684; table.js &#x5BF9; CheckBox &#x7EC4;&#x4EF6;&#x7684;&#x4F9D;&#x8D56;&#x5F15;&#x5165;&#xFF1A;</p>
<pre class="language-"><code class="lang-javascript">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&quot;element-ui/lib/checkbox&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<p>&#x8FD9;&#x4E48;&#x5904;&#x7406;&#x7684;&#x8BDD;&#xFF0C;&#x5C31;&#x4E0D;&#x4F1A;&#x6253;&#x5305;&#x751F;&#x6210; 2 &#x4EFD; CheckBox JS &#x90E8;&#x5206;&#x7684;&#x4EE3;&#x7801;&#x4E86;&#xFF0C;&#x4F46;&#x662F;&#x5BF9;&#x4E8E; CSS &#x90E8;&#x5206;&#xFF0C;element-ui &#x5E76;&#x672A;&#x5904;&#x7406;&#x5197;&#x4F59;&#x60C5;&#x51B5;&#xFF0C;&#x53EF;&#x4EE5;&#x770B;&#x5230; lib/theme-chalk/checkbox.css &#x548C; lib/theme-chalk/table.css &#x4E2D;&#x90FD;&#x4F1A;&#x6709; CheckBox &#x7EC4;&#x4EF6;&#x7684; CSS &#x6837;&#x5F0F;&#x3002;</p>
<p>&#x5176;&#x5B9E;&#xFF0C;&#x8981;&#x89E3;&#x51B3;&#x6309;&#x9700;&#x5F15;&#x5165;&#x7684; JS &#x548C; CSS &#x7684;&#x5197;&#x4F59;&#x95EE;&#x9898;&#x5E76;&#x975E;&#x96BE;&#x4E8B;&#xFF0C;&#x53EF;&#x4EE5;&#x7528;&#x540E;&#x7F16;&#x8BD1;&#x7684;&#x601D;&#x60F3;&#xFF0C;&#x5373;&#x4F9D;&#x8D56;&#x5305;&#x63D0;&#x4F9B;&#x6E90;&#x7801;&#xFF0C;&#x800C;&#x7F16;&#x8BD1;&#x4EA4;&#x7ED9;&#x5E94;&#x7528;&#x5904;&#x7406;&#xFF0C;&#x8FD9;&#x6837;&#x4E0D;&#x4EC5;&#x4E0D;&#x4F1A;&#x6709;&#x7EC4;&#x4EF6;&#x5197;&#x4F59;&#x4EE3;&#x7801;&#xFF0C;&#x751A;&#x81F3;&#x8FDE;&#x7F16;&#x8BD1;&#x7684;&#x5197;&#x4F59;&#x4EE3;&#x7801;&#x90FD;&#x4E0D;&#x4F1A;&#x6709;</p>
<h2 id="&#x5DE5;&#x7A0B;&#x5316;"><a name="&#x5DE5;&#x7A0B;&#x5316;" class="anchor-navigation-ex-anchor" href="#&#x5DE5;&#x7A0B;&#x5316;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5DE5;&#x7A0B;&#x5316;</h2>
<p>&#x524D;&#x7AEF;&#x5BF9;&#x4E8E;&#x5DE5;&#x7A0B;&#x5316;&#x7684;&#x8981;&#x6C42;&#x8D8A;&#x6765;&#x8D8A;&#x9AD8;&#xFF0C;element-ui &#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x7EC4;&#x4EF6;&#x5E93;&#xFF0C;&#x5B83;&#x5728;&#x5DE5;&#x7A0B;&#x5316;&#x65B9;&#x9762;&#x505A;&#x4E86;&#x54EA;&#x4E9B;&#x4E8B;&#x60C5;&#x5462;&#xFF1F;</p>
<p>&#x9996;&#x5148;&#x662F;&#x5F00;&#x53D1;&#x9636;&#x6BB5;&#xFF0C;&#x4E3A;&#x4E86;&#x4FDD;&#x8BC1;&#x5927;&#x5BB6;&#x4EE3;&#x7801;&#x98CE;&#x683C;&#x7684;&#x4E00;&#x81F4;&#x6027;&#xFF0C;&#x4F7F;&#x7528;&#x4E86; ESLint&#xFF0C;&#x751A;&#x81F3;&#x4E13;&#x95E8;&#x5199;&#x4E86; eslint-config-elemefe &#x4F5C;&#x4E3A; ESint &#x7684;&#x6269;&#x5C55;&#x89C4;&#x5219;&#x914D;&#x7F6E;&#xFF1B;&#x4E3A;&#x4E86;&#x65B9;&#x4FBF;&#x672C;&#x5730;&#x5F00;&#x53D1;&#x8C03;&#x8BD5;&#xFF0C;&#x501F;&#x52A9;&#x4E86; webpack &#x5E76;&#x914D;&#x7F6E;&#x4E86; Hot Reload&#xFF1B;&#x5229;&#x7528;&#x6A21;&#x5757;&#x5316;&#x5F00;&#x53D1;&#x7684;&#x601D;&#x60F3;&#x628A;&#x7EC4;&#x4EF6;&#x4F9D;&#x8D56;&#x7684;&#x4E00;&#x4E9B;&#x516C;&#x5171;&#x6A21;&#x5757;&#x653E;&#x5728;&#x4E86; src &#x76EE;&#x5F55;&#xFF0C;&#x5E76;&#x4F9D;&#x636E;&#x529F;&#x80FD;&#x62C6;&#x5206;&#x51FA; directives&#x3001;locale&#x3001;mixins&#x3001;transitions&#x3001;utils &#x7B49;&#x6A21;&#x5757;&#x3002;</p>
<p>&#x5176;&#x6B21;&#x662F;&#x6D4B;&#x8BD5;&#x65B9;&#x9762;&#xFF0C;&#x4F7F;&#x7528;&#x4E86; karma &#x6D4B;&#x8BD5;&#x6846;&#x67B6;&#xFF0C;&#x4E3A;&#x6BCF;&#x4E00;&#x4E2A;&#x7EC4;&#x4EF6;&#x7F16;&#x5199;&#x4E86;&#x5355;&#x5143;&#x6D4B;&#x8BD5;&#xFF0C;&#x5E76;&#x4E14;&#x5229;&#x7528; Travis CI &#x96C6;&#x6210;&#x4E86;&#x6D4B;&#x8BD5;&#x3002;</p>
<p>&#x63A5;&#x7740;&#x662F;&#x6784;&#x5EFA;&#x65B9;&#x9762;&#xFF0C;element-ui &#x7F16;&#x5199;&#x4E86;&#x5F88;&#x591A; npm scripts&#xFF0C;&#x4EE5; dist &#x8FD9;&#x4E2A; script &#x4E3A;&#x4F8B;&#xFF1A;</p>
<pre class="language-"><code> &quot;dist&quot;: &quot;npm run clean &amp;&amp; npm run build:file &amp;&amp; npm run lint &amp;&amp; webpack --config build/webpack.conf.js &amp;&amp; webpack --config build/webpack.common.js &amp;&amp; webpack --config build/webpack.component.js &amp;&amp; npm run build:utils &amp;&amp; npm run build:umd &amp;&amp; npm run build:theme&quot;
</code></pre><p>&#x5B83;&#x5185;&#x90E8;&#x4F1A;&#x4F9D;&#x6B21;&#x6267;&#x884C;&#x591A;&#x4E2A;&#x547D;&#x4EE4;&#xFF0C;&#x6700;&#x7EC8;&#x4F1A;&#x751F;&#x6210; lib &#x76EE;&#x5F55;&#x548C;&#x6253;&#x5305;&#x540E;&#x7684;&#x6587;&#x4EF6;&#x3002;&#x6211;&#x5E76;&#x4E0D;&#x6253;&#x7B97;&#x4ECB;&#x7ECD;&#x6240;&#x6709;&#x7684;&#x547D;&#x4EE4;&#xFF0C;&#x611F;&#x5174;&#x8DA3;&#x540C;&#x5B66;&#x53EF;&#x81EA;&#x884C;&#x7814;&#x7A76;&#xFF0C;&#x8FD9;&#x91CC;&#x6211;&#x60F3;&#x4ECB;&#x7ECD;&#x4E00;&#x4E0B; build:file &#x8FD9;&#x4E2A; script &#x505A;&#x7684;&#x4E8B;&#x60C5;&#xFF1A;</p>
<pre class="language-"><code>&quot;build:file&quot;: &quot;node build/bin/iconInit.js &amp; node build/bin/build-entry.js &amp; node build/bin/i18n.js &amp; node build/bin/version.js&quot;
</code></pre><p>&#x8FD9;&#x91CC;&#x4F1A;&#x4F9D;&#x6B21;&#x6267;&#x884C; build/bin &#x76EE;&#x5F55;&#x4E0B;&#x7684;&#x4E00;&#x4E9B; Node &#x811A;&#x672C;&#xFF0C;&#x5BF9; icon&#x3001;entry&#x3001;i18n&#x3001;version &#x7B49;&#x505A;&#x4E86;&#x4E00;&#x7CFB;&#x5217;&#x7684;&#x521D;&#x59CB;&#x5316;&#x5DE5;&#x4F5C;&#xFF0C;&#x5B83;&#x4EEC;&#x7684;&#x5185;&#x5BB9;&#x90FD;&#x662F;&#x6839;&#x636E;&#x4E00;&#x4E9B;&#x89C4;&#x5219;&#x505A;&#x6587;&#x4EF6;&#x7684; IO&#xFF0C;&#x8FD9;&#x4E48;&#x505A;&#x7684;&#x597D;&#x5904;&#x5C31;&#x662F;&#x5B8C;&#x5168;&#x901A;&#x8FC7;&#x5DE5;&#x5177;&#x7684;&#x624B;&#x6BB5;&#x81EA;&#x52A8;&#x5316;&#x751F;&#x6210;&#x6587;&#x4EF6;&#xFF0C;&#x6BD4;&#x4EBA;&#x5DE5;&#x9760;&#x8C31;&#x4E14;&#x6548;&#x7387;&#x66F4;&#x9AD8;&#xFF0C;&#x8FD9;&#x6CE2;&#x64CD;&#x4F5C;&#x975E;&#x5E38;&#x503C;&#x5F97;&#x6211;&#x4EEC;&#x5B66;&#x4E60;&#x548C;&#x5E94;&#x7528;&#x3002;</p>
<p>&#x6700;&#x540E;&#x662F;&#x90E8;&#x7F72;&#xFF0C;&#x901A;&#x8FC7; pub &#x8FD9;&#x4E2A; npm script &#x5B8C;&#x6210;&#xFF1A;</p>
<pre class="language-"><code> &quot;pub&quot;: &quot;npm run bootstrap &amp;&amp; sh build/git-release.sh &amp;&amp; sh build/release.sh &amp;&amp; node build/bin/gen-indices.js &amp;&amp; sh build/deploy-faas.sh&quot;
</code></pre><p>&#x4E3B;&#x8981;&#x662F;&#x901A;&#x8FC7;&#x8FD0;&#x884C;&#x4E00;&#x7CFB;&#x5217;&#x7684; bash &#x811A;&#x672C;&#xFF0C;&#x5B9E;&#x73B0;&#x4E86;&#x4EE3;&#x7801;&#x7684;&#x63D0;&#x4EA4;&#x3001;&#x5408;&#x5E76;&#x3001;&#x7248;&#x672C;&#x7BA1;&#x7406;&#x3001;npm &#x53D1;&#x5E03;&#x3001;&#x5B98;&#x7F51;&#x53D1;&#x5E03;&#x7B49;&#xFF0C;&#x8BA9;&#x6574;&#x4E2A;&#x53D1;&#x5E03;&#x6D41;&#x7A0B;&#x81EA;&#x52A8;&#x5316;&#x5B8C;&#x6210;&#xFF0C;&#x811A;&#x672C;&#x5177;&#x4F53;&#x5185;&#x5BB9;&#x611F;&#x5174;&#x8DA3;&#x7684;&#x540C;&#x5B66;&#x53EF;&#x81EA;&#x884C;&#x67E5;&#x770B;&#x3002;</p>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; YoungGary 2019 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2020-01-03 16:31:06
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="proxy.html" class="navigation navigation-prev " aria-label="Previous page: 1.Vue.js 3.0中的响应式">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="bind.html" class="navigation navigation-next " aria-label="Next page: 3.bind的模拟实现">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"2.Element UI 源码初探","level":"1.5.2","depth":2,"next":{"title":"3.bind的模拟实现","level":"1.5.3","depth":2,"path":"js/bind.md","ref":"js/bind.md","articles":[]},"previous":{"title":"1.Vue.js 3.0中的响应式","level":"1.5.1","depth":2,"path":"js/proxy.md","ref":"js/proxy.md","articles":[]},"dir":"ltr"},"config":{"plugins":["theme-comscore","prism","-highlight","copy-code-button","search-pro","-search","-lunr","expandable-chapters","splitter","-sharing","tbfed-pagefooter","anchor-navigation-ex"],"styles":{},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy YoungGary 2019","modify_label":"该文件修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"prism":{"css":["prismjs/themes/prism-solarizedlight.css"],"lang":{"shell":"bash"}},"splitter":{},"search-pro":{},"fontsettings":{"theme":"white","family":"sans","size":2},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":false},"theme-comscore":{},"copy-code-button":{},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"expandable-chapters":{}},"theme":"default","author":"Gary","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Gary的小窝","language":"zh-hans","gitbook":"*","description":"Gary的小窝. 里面包含了个人撰写的技术文章"},"file":{"path":"js/el.md","mtime":"2020-01-03T08:31:06.073Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-09-09T14:10:10.930Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-copy-code-button/toggle.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-theme-comscore/test.js"></script>
        
    

    </body>
</html>

